anushya has asked for the wisdom of the Perl Monks concerning the following question:
I want to read 60, 74 and 83 in an array. I tried to get that, but i am getting only the first value(60). My script:<>.....</>....<member_id>60</member_id><..><..>...<member_id>74</membe +r_id>....<member_id>83</member_id><>....</>...
Anybody please help me to solve this.#! /usr/bin/perl -w $file = '/home/anushya/response_1.xml'; open(FP, $file); @lines = <FP>; foreach $num (@lines) { if ($num =~ m/<member-id>(\d+)/){ @val = $1; print $val[0],"\n"; } } close(FP);
Edited by Chady -- added code tags, and minor formatting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading a particular values from the file.
by anniyan (Monk) on Nov 23, 2005 at 14:12 UTC | |
|
Re: Reading a particular values from the file.
by murugu (Curate) on Nov 23, 2005 at 14:29 UTC | |
|
Re: Reading a particular values from the file.
by davorg (Chancellor) on Nov 23, 2005 at 14:15 UTC | |
|
Re: Reading a particular values from the file.
by marto (Cardinal) on Nov 23, 2005 at 14:17 UTC |