Hello Perl Monks, This is my first post. May be simple/silly Q for you :) I am using the below code and it works when i use print. I want to assign it to scalar variable because only one element will be the output of map. I can use foreach loop instead of map. I want to know is there any way i can achieve using map and assign the result to scalar variable ?
# ok # print map { $1 if /^\*\s\(?([^\)]+)\)?/} @GET_STRING; # not ok # $VAL=map { $1 if /^\*\s\(?([^\)]+)\)?/} @GET_STRING;
In reply to Assign result of map to scalar variable by ram31
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |