On 9/19/11 Mon Sep 19, 2011 5:56 PM, "Rajeev Prasad" <rp.ne...@yahoo.com> scribbled:
> $string="alpha number='42'" > $string=~s/.*\=// ; > $string=~s/\'//g; > > to get 42 and not '42' > > > can these two substitutions be combined? If you know what you want to extract, then use capturing: if( $string =~ /'(\d+)'/ ) { $number = $1; } or shorter (but not better): ($number) = $string =~ /'(\d+)'/; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/