Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Passing results of a substitution to a function

by BrowserUk (Patriarch)
on Jan 20, 2003 at 12:05 UTC ( #228327=note: print w/replies, xml ) Need Help??


in reply to Passing results of a substitution to a function

Your sample code doesn't make much sense in that you are not applying the s/// to anything.

You say you want to pass the results of the s/// to the sub, without recourse to a temporary var. If your intent is to apply the s/// to $word, then this requires no additional vars.

$word = 'BLAHBLAH'; $word =~ s/BLAH/COW/; print blah( $word ); print "$word\n";

It's not clear to me if this is what you want, but if it's not, maybe you could clarify for me?


Examine what is said, not who speaks.

The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

Replies are listed 'Best First'.
Re: Re: Passing results of a substitution to a function
by Anonymous Monk on Jan 20, 2003 at 23:28 UTC
    I want to apply the s/// to $word, but I want to keep the contents of $word as is. It's a one-off non-permanent substitution I'm making (for the purpose of feeding arguments into the method).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://228327]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2023-09-26 08:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?