in reply to Re: Using map
in thread Using map

My apologies for posting bad code, the result you see above was a feeble attempt to see where I was going wrong because I was not receiving the results I was expecting. I apologise for this, my original code read:
my @sub_locs = map { s/taxman.add.subloc.// } @session_keys;

While I read up on most of the posts, the perldocs and looked at the examples in the camel book, the concept must have missed me by a mile. Thanks for clarifying, I am aware of the dots though for some reason I didn't escape them, I guess I got lazy since I used to escape them in previous code I've written, though I haven't experienced any funky results by not escaping them yet.

BlackJudas

Replies are listed 'Best First'.
Re: Re: Re: Using map
by suaveant (Parson) on Oct 05, 2001 at 17:26 UTC
    You would only receive funky results if you had a file that had a character where you are looking for a . that was not a . say if you had a file name taxman.add2subloc.foo you would still match even though it has a 2 instead of a .
    And let me tell you... you don't not want to try to track that error down :) Those are the impossible to find errors :)

    and, as has been said, $_ inside the map code block is an alias to the item in the array, so any changes made directly to it (like substitutions) will edit the values in the array.

                    - Ant
                    - Some of my best work - Fish Dinner