From:                   Nikola Janceski <[EMAIL PROTECTED]>
To:                     "Beginners (E-mail)" <[EMAIL PROTECTED]>
Subject:                Can you make it use one or more less vars?
Date sent:              Tue, 11 Jun 2002 09:17:38 -0400

> 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.

The $rcsfile is not needed.

sub rcsname {
        my $file = shift;
        $file =~ s{somepattern}{andsubstitution};
        return $file;
}

The shift() is enough to make a copy of the string.

Jenda
=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
                                        --- me


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to