On Jun 11, Nikola Janceski said:
>Can this be simplified with less variables?
>
>sub rcsname {
>my $file = shift;
>(my $rcsfile = $file) =~ s{somepattern}{andsubstitution};
>return $rcsfile;
>}
>
>### remember that the original arguement CANNOT be affected.
What makes you think that:
sub rcsname {
(my $file = shift) =~ s/foo/bar/;
return $file;
}
modifies the ACTUAL argument you passed to rcsname()? Only if you had
done
sub rcsname {
$_[0] =~ s/foo/bar/;
}
or passed a reference and done
sub rcsname {
my $file = shift;
$$file =~ s/foo/bar/;
}
or some other specific effort would you have modified the argument to the
function.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]