in reply to Re: (FoxUni) Re(3): XML parsing
in thread XML parsing
Assuming that you just want the number between the FILE_SIZE tags, you can do something like:
This avoids running an external command and does not require the value to start at on offset of 13 in the second line from last. Even though it is more flexible, it would not be the right approach to parse XML data, but in your difficult situation I guess you can't do much better.open my $fh, "<$ack_filename" or die "open error: $!"; my $file_size; while (<$fh>) { chomp; if (m|<file_size>([^<]*)</file_size>|i) { $file_size = $1; last; } } $fh->close; print $file_size;
Then again, if the people you work with are so stupid and stubborn, maybe they deserve such code or worse.
Good luck getting out of there.
/prakash
|
|---|