Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by badco

  1. badco

    Beware Newbie Q: Quick script to search and replace.

    Try this and modify it for what you are doing: use strict; my $db = 'yourfilehere.txt'; open(DATA, &quot;$db&quot;) || die &quot;Can not open: $!\n&quot;; my @dat = (<DATA>); close(DATA); open(DATA, &quot;>$db&quot;) || die &quot;NO GO: $!\n&quot...
  2. badco

    suppressing error messages

    Try this: open STDERR, &quot;> /dev/null&quot; || die &quot;Cant redirect standard error: $!&quot;; ================= Bad Company Music =================
  3. badco

    Subject in mail

    Try smtp in a hash: { my %mail = ( To => 'to_email_address', From => 'from_email_address', Subject => &quot;Bad Company with Paul Rodgers&quot;, Message => &quot;Message you want in your email message&quot;, ); $mail{smtp} = '111.222.3.44'; #your smtp ip address sendmail(%mail) ||...
  4. badco

    Subject in mail

    Did you put in all your Header info? use Net::SMTP; $smtp->datasend(&quot;From: $Fromaddresshere\n&quot;); $smtp->datasend(&quot;To: $Toaddresshere\n&quot;); $smtp->datasend(&quot;Subject: MySubject\n&quot;); $smtp->datasend(&quot;\n&quot;); ================= Bad...
  5. badco

    Validate Email Address Function

    I would use a Perl module called Email::Valid for validating email addresses. use Email::Valid; unless (Email::Valid -> address($email_addr)) { warn &quot;Not valid Email address\n&quot;; return; } ================= Bad Company Music =================
  6. badco

    Extract the header of a Web site

    Here is another way you can try. I am just giving you an example here without proxy address part. As you can see I chose to print out all data and then extract specifically &quot;last modification data&quot;. For content-type you use the &quot;0&quot; index and for content-length you use...
  7. badco

    or statement and directory empty statements

    Try these: if (($dirname eq &quot;bass_tabs&quot;) || ($dirname eq &quot;drum_tabs&quot;)) For your directory check use !-s. Meaning File or directory exists and has nonzero size, so you need the opposite as my example shows. ================= Bad Company Music =================
  8. badco

    FTP attempt

    Try this below: use Net::FTP; use strict; use warnings; my $ftp = Net::FTP->new(&quot;servername.here.com&quot;, Debug => 0) or die &quot;cant connect: $@\n&quot;; $ftp->login(&quot;myname&quot;, &quot;mypassword&quot;); $ftp->cwd(&quot;/yourdirectorypathhere/directory&quot;)...
  9. badco

    printing multiple array elements

    @array = ('Value1', 'Value2', 'Value3','Value4','Value5'); print &quot;@array[2..4]\n&quot;; ================= Bad Company Music =================
  10. badco

    I have some queries...can anyone help me ???

    vikul, Subroutines keep their internal variables private and pass information in and out with parameters and values and oop helps perl scriptss hide complexities of programs' low level details and helps keep you from touching the messy stuff. For example on use of LWP::Simple where you can use...
  11. badco

    Fetching files

    This should work for you: find . -exec ls -l {} \; | grep smith ================= Bad Company Music =================
  12. badco

    PERL SMTP on Windows 2000?

    Try this example as something to work with when setting up your Perl mail script: [/tt] { #use hash my %mail = ( To => 'to_email_address', From => 'from_email_address', Subject => &quot;Rough Diamonds&quot;, Message => &quot;Message you want in your...
  13. badco

    Save system(FTP) alerts to file?

    I run my winnt/tasks/add scheduled tasks daily with a Net ping script to a text file with no problems. Just set your times according to how often you want to run the script similiar to unix cron. ================= Bad Company Music =================
  14. badco

    Script Error

    Two major types of error conditions are internal errors (command problems or invalid information given by user) and external errors that the shell procedure must respond to properly. External errors are sent to the shell with a signal sent by the system telling you that some system-level event...
  15. badco

    get_files problem

    chdir is used in Unix Bourne and C Shell AND NT so you are okay with it here. ls is used in Unix shells but NOT NT so you should use dir instead for your script. pwd is used for Unix and cd should be used for NT current working directory. Example: $ls = `ls $file`; #unix $ls = `dir $file`...

Part and Inventory Search

Back
Top