in reply to help with s/// inside map

map evaluates the block in list context. Whatever the code inside the block returns in list context is what map will see.

The substititution operator s/// returns the number of substitutions made (in this case 1). So map will get a list of 1s. You could still use the substitution operator if you can force the code inside the block to return the string you want, like this:

my @delete_list = map {s/^delete_check_//; $_} (grep /^delete_check_/, + keys %session);
Now the block returns $_ after doing the substitution, so it should map correctly.

When you use the match operator m// in list context without the /g modifier and with capturing parentheses, it returns a list of the matches. That's why your second example works, because in list context the code block returns the text you're looking for. Here's another simple example of m// returning a list of matches in list context:

my $str = "Helloooo, nurse!" my ($greeting, $recipient) = $str =~ m/^(\w+),\s+(\w+)/; print "Greeting: '$greeting', Recipient: '$recipient'\n";