Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Passing results of a substitution to a function

by Pardus (Pilgrim)
on Jan 20, 2003 at 03:38 UTC ( [id://228274]=note: print w/replies, xml ) Need Help??


in reply to Passing results of a substitution to a function

This can't be done directly since the search and replace functions return the number of matches, not the string.

But you could do this:
$word = 'blah'; print my_sub(map {s/blah/cow/; $_} ($word));
although it _is_ a one-liner it won't get a beauty price either.
--
Jaap Karssenberg || Pardus (Larus)? <pardus@cpan.org>
>>>> Zoidberg: So many memories, so many strange fluids gushing out of patients' bodies.... <<<<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-16 08:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found