in reply to how to find particular string and store in to variable

Hi Bushan,

This is a classic situation where a regular expression is your solution.

Please read http://perldoc.perl.org/perlretut.html

For your situation you need something like:

my $string = 'http://172.20.37.115:8080/se/1.0/provision/subscribers/1 +98968'; my ($wanted) = $string =~ m/ \d+$ /gx;

Replies are listed 'Best First'.
Re^2: how to find particular string and store in to variable
by AnomalousMonk (Archbishop) on Jun 25, 2015 at 13:53 UTC

    Note that in the case in which there is no match, a subsequent step is needed to give  $wanted a defined value (if this is wanted!) if  \d+ is used.


    Give a man a fish:  <%-(-(-(-<