in reply to Re: Passing results of a substitution to a function
in thread Passing results of a substitution to a function
The { s/BLAH/COW/ || 1 } bit is required as I want to also pass in arguments which do not contain 'BLAH' (which grep would usually.. er.. grep away ;) ). I was worried about list context before because I was trying to get around this by usingmy $word = 'BLAHBLAH' blah(grep {s/BLAH/COW/ || 1 } $word);
blah(grep(s/BLAH/COW/,$word)||$word)
|
|---|