On 9/18/07, Ryan Moszynski <[EMAIL PROTECTED]> wrote:
> thanks,
>
> so i can just test to see if $_[3]
>
> exists
>
> and it kills the warning.
>
> On 9/18/07, Andrew Curry <[EMAIL PROTECTED]> wrote:
> > @_ is the list of incoming parameters to a sub. So if you write a sub, you
> > refer to the first parameter in it as $_[0], the second parameter as $_[1]
> > and so on. And you can refer to $_# as the index number of the last
> > parameter:
> >
> > -----Original Message-----
> > From: Ryan Moszynski [mailto:[EMAIL PROTECTED]
> > Sent: 18 September 2007 15:12
> > To: beginners@perl.org
> > Subject: perl default variable question
> >
> > hi,
> > i'm using a perl script i found to change the names of batches of files.
> > The program works as is but it's giving me a weird warning.
> > I'm familiar with $_, but not $_[3].  Can someone explain what $_[3] is, and
> > how i can get this script to stop throwning the warning?
> >
> > Thanks,
> >
> > Ryan
> >
> > i found the file here:
> >
> > http://noisybox.net/computers/eren/
> >
> > file download link:
> > http://noisybox.net/computers/eren/eren.pl
> >
> > warning thrown:
> > Use of uninitialized value in pattern match (m//) at C:\pPerl\eren.pl line
> > 82.
> >
> > (i changed the file a bit so it won't be the same line number if you
> > checkout the whole file)
> >
> > code from my file:
> >
> > 76 foreach my $file (@files){
> > 77      next if -d($root . $file);
> > 78
> > 79      next if (($preview) and not ($file =~ /$filefilter/));
> > 80      @_ = split /\//, $replacestr;
> > 81      my $icase = '';
> > 82      ($_[3] =~ /i/) and $icase = 'i';
> > #**************************************************
> > 83      my $cmd = sprintf("\$file =~ /%s/%s;", $_[1], $icase);
> > 84
> > 85      next if not eval $cmd;
> > 86
> > 87      $preview and print "PREVIEW: ";
> > 88      $matchct++;
> > 89
> > 90      my $oldfile = $file;
> > 91      print "$oldfile --> ";
> > 92      $file =~ eval " \$file =~ s$replacestr;";
> > 93      print "$file\n";
> > 94      $preview and next;
> > 95      rename($root . $oldfile, $root . $file) or print "Failed to rename
> > $root$oldfile\n";
> > 96 }
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
> > commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
> >
> >
> >
> > This e-mail is from the PA Group.  For more information, see
> > www.thepagroup.com.
> >
> > This e-mail may contain confidential information.  Only the addressee is
> > permitted to read, copy, distribute or otherwise use this email or any
> > attachments.  If you have received it in error, please contact the sender
> > immediately.  Any opinion expressed in this e-mail is personal to the sender
> > and may not reflect the opinion of the PA Group.
> >
> > Any e-mail reply to this address may be subject to interception or
> > monitoring for operational reasons or for lawful business practices.
> >
> >
> >
> >
> >
>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to