http://www.perlmonks.org?node_id=578917


in reply to grep not working as expected

Does it still not work if you do the following:

my $param = $q->param('report_type'); print "param=" . $param . "<BR>"; if( grep { /$param/ } (qw/case_id hosp_alias sender receiver/) ) { print "we are getting the list<BR>"; } else { print "we are NOT getting the list<BR>"; }

If it still doesn't work, then something is wrong somewhere else. If this does work, then perhaps the answer is tied to Fletch's response to the post just before yours, Re: Strange behaviour of m and $_ - in that (quoting Fletch) "Subroutine invoations don't interpolate in double quoted strings (of which m// is a special kind.)"



--chargrill
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)