Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple question (I think anyway) 1

Status
Not open for further replies.

travs69

MIS
Dec 21, 2006
1,431
US
When using the cgi module

why can't I do this
@out = grep /param(what)/, @test;

I have do to do
$what = param(what);
@out = grep /$what/, @test;


Probably something simple and if the proper way is the second way that's fine to, but I need some explaining so I understand why.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those Who Say It Cannot Be Done Are Usually Interrupted by Someone Else Doing It; Give the wrong symptoms, get the wrong solutions;
 
param() is a funtion (or method), it will not work inside a matching (m/pattern/) regular expression. The parenthesis in this context are for capturing patterns in memory, not sending arguments to functions.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Thanks :)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those Who Say It Cannot Be Done Are Usually Interrupted by Someone Else Doing It; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top