blackjudas has asked for the wisdom of the Perl Monks concerning the following question:
I had expected all the keys that contained the 'delete_check_' string at the beginning to be stripped and the remaining values to be populated into the @delete_list array. I instead got a relative number of 1's where I expected the results. I know that map returned a status, meaning, 1 "I've done the job you have requested". So, at this point I went through some of my old code and came up with:my @delete_list = map {$_ =~ s/^delete_check_//} (grep /^delete_check_ +/, keys %session);
This approach worked beautifully as I had expected. What I'm curious about is, what exactly do I need to pass to map inside the block to return the correct result? I'm still on the fence here regarding my full understanding of the map function. Therefore I'm worried that I have a bigger underlying issue of understanding when it comes to expressions and what exactly they are. Is it that map is one of the few functions in perl that needs special care on how you "express" yourself with it?my @delete_list = map {/^delete_check_(.*)/} (grep /^delete_check_/, k +eys %session);
Edit kudra, 2002-05-15 Changed title
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: How to express myself
by jeffa (Bishop) on May 14, 2002 at 21:43 UTC | |
by Kanji (Parson) on May 15, 2002 at 00:28 UTC | |
|
•Re: How to express myself
by merlyn (Sage) on May 15, 2002 at 00:31 UTC | |
by blackjudas (Pilgrim) on May 15, 2002 at 00:36 UTC | |
|
Re: How to express myself
by thelenm (Vicar) on May 14, 2002 at 21:59 UTC | |
|
Re: How to express myself
by csotzing (Sexton) on May 14, 2002 at 21:53 UTC |