[EMAIL PROTECTED] (Sumit Shah) writes:
> I have a string like: 'a = 1; b = 2; c = 3; d = 4'
>
> Whats the best way to parse it so that I can get a value for c, which
> is 3? I have used the hash approach. But, I was wondering if there is
> a faster way to do it in Perl.
I don't know about `best', but the following regex works fine for me.
my $text = 'a = 1; b = 2; c = 3; d = 4';
if ($text =~ /c\s=\s(\d)/xms) {
print "Got $1!\n";
}
--
Ralph Moritz
Ph: (W) +27 315 629 557
(M) +27 846 269 070
Fx: +27 866 039 136
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/