$str =~ /food1=(\w+)/; print $1;
The parenthesis 'remeber' what's inside of them, so the $1 variable contains the first remebered variable (from left to right): If you had more parenthesis, they would go into $2, $3, .. $9. You can find more about regular expressions here.
As a side note, you might want to check out DBI if you're dealing with databases.In reply to Re: how do i find the word following a specific word
by Arguile
in thread how do i find the word following a specific word
by anjaana78
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |