On 11-09-19 08:56 PM, Rajeev Prasad wrote:
$string="alpha number='42'"
$string=~s/.*\=// ;
$string=~s/\'//g;
to get 42 and not '42'
can these two substitutions be combined?
thank you.
It depends on what you want to extract. To extract a string inside
single quotes after an equal sign:
On 20/09/2011 02:17, Jim Gibson wrote:
On 9/19/11 Mon Sep 19, 2011 5:56 PM, "Rajeev Prasad"
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 capturin
On 9/19/11 Mon Sep 19, 2011 5:56 PM, "Rajeev Prasad"
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+)
On 20/09/2011 01:56, Rajeev Prasad wrote:
$string="alpha number='42'"
$string=~s/.*\=// ;
$string=~s/\'//g;
to get 42 and not '42'
can these two substitutions be combined?
Hi Rajeev
Well they can be combined, and because it is far from obvious what your
code is doing I think it should be r
$string="alpha number='42'"
$string=~s/.*\=// ;
$string=~s/\'//g;
to get 42 and not '42'
can these two substitutions be combined?
thank you.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/