in reply to extracting a substring from a string - multiple variables
Do you mean something like this?
my $string = '...blah...<file fiop="foo" length="bar"/>baz</file>...bl +ah...'; my ( $foo, $bar, $baz ); if ( $string =~ s{<file fiop="([^"]+)" length="([^"]+)"/>([^<]+)</file +>}{} ) { ( $foo, $bar, $baz ) = ( $1, $2, $3 ); print "extracted $foo, $bar, $baz; left $string\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: extracting a substring from a string - multiple variables
by walinsky (Scribe) on Oct 27, 2007 at 23:10 UTC | |
by graff (Chancellor) on Oct 27, 2007 at 23:48 UTC | |
by walinsky (Scribe) on Oct 28, 2007 at 00:41 UTC | |
|
Re^2: extracting a substring from a string - multiple variables
by duff (Parson) on Oct 29, 2007 at 13:46 UTC |