[tpm] YARE (yet another regex) question

Madison Kelly linux at alteeve.com
Fri Aug 1 09:17:56 PDT 2008


Fulko Hew wrote:
> 
> 
> On Fri, Aug 1, 2008 at 10:50 AM, Madison Kelly <linux at alteeve.com 
> <mailto:linux at alteeve.com>> wrote:
> 
>      As an expansion to my earlier question on assigning values to new
>     variables directly from a regular expression; I want to now use a
>     similar technique to populate a 'foreach' loop.
> 
> 
> 
> ... snip ...
>  
> 
>     However, this doesn't:
> 
>     my $results_page=$agent->content;
>     my %results=();
>     foreach (my $variable, my $value) ($results_page=~/<input
>     name="(.*?)" type="hidden" value="(.*?)">/gs)
> 
>                                   ^^
> 
> How about... you forgot the equal sign for the assignment!

Doesn't look like this is the case (tried it to be sure), or if it is, I 
am note sure where the '=' would go for the assignment. As I understand 
the 'for'/'foreach' syntax is that is automatically pops a value off the 
array per iteration.

Not that I am not often wrong. :)

Madi


More information about the toronto-pm mailing list