in reply to problem with variables
You don't need to do s/// - and you're not checking that the regex has actually matched, before copying $1 into your own variables. In other words, all three of your variables get set to $1 each time round the while loop.
Try replacing:
s/<volume>(.*)<\/volume>//;$vol=$1; s/<issue>(.*)<\/issue>//;$iss=$1; s/<year>(.*)<\/year>//;$yr=$1;
with:
$vol = $1 if /<volume>(.*)<\/volume>/; $iss = $1 if /<issue>(.*)<\/issue>/; $yr = $1 if /<year>(.*)<\/year>/;
(Note: untested)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: problem with variables
by ishnid (Monk) on Sep 15, 2004 at 12:11 UTC | |
|
Re^2: problem with variables
by texuser74 (Monk) on Sep 15, 2004 at 09:50 UTC |