|Do you know where your variables are?|
Variable/multiple matches using grepby Anonymous Monk
|on Aug 11, 2006 at 16:20 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
I am trying to use grep to query a CSV file against incoming data from a html form. There are four drop down fields and I want to be able to match against the CSV data depending on what is selected. For example the user could only select drop downs one and four.
@result = grep /$one.$two.$three.$four/, @data;
The above works but if $one has the value of 1 it matches against every instance on 1 in the CSV file. Is there a way to limit the match as /^$one$/ would work for example?
Any help, advice or alternatives would be greatly appreciated. Thanks