in reply to how to find particular string and store in to variable
A different approach:
#!/usr/bin/env perl use strict; use warnings; use URI::URL; use feature qw(say); my $url = URI::URL->new( q(http://172.20.37.115:8080/se/1.0/provision/subscribers/198968)); # say( map { ( split /\// )[-1] } $url->path ); my ($var) = map { ( split /\// )[-1] } $url->path; say $var; __END__ karls-mac-mini:monks karl$ ./1131943.pl 198968
Please see also URI::URL, map, split and TMTOWTDI.
Update: For a better solution (my @paths = $url->path_segments;) please see below.
Regards, Karl
«The Crux of the Biscuit is the Apostrophe»
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to find particular string and store in to variable
by Anonymous Monk on Jun 25, 2015 at 19:20 UTC | |
by karlgoethebier (Abbot) on Jun 25, 2015 at 19:43 UTC |