in reply to grep for numbers

Hi sandy1028,
Not sure if this helps, but it's very easy to extract the number that follows ci= from the example you provided:
use warnings; use strict; no warnings 'numeric'; my $str = q(<body onunload="params='s=o&n=o&ci=5413226&iv=0&pi=34&sess +id=c1e7be2e5d3518213a67577cf5b2b1c4bd0a0619&uuid=c1e7be2e5d3518213a67 +577cf5b2b1c4bd0a0619&prt=1238476904&pgtp=article&eagi=&t_v=v&">); my $num = (split /ci=/, $str)[1] + 0; print $num;
Cheers,
Rob

Replies are listed 'Best First'.
Re^2: grep for numbers
by leonidlm (Pilgrim) on Mar 31, 2009 at 08:06 UTC
    Why not to use this one?
    my $num = $1 if ($str =~ /ci=(\d+)&/);