http://qs321.pair.com?node_id=180949


in reply to How can I extract part of a string after a specific character

I suspect split would be your best choice-

# split my ($key, $string1) = split /=/, $_, 2; print "$key, $string1\n";

Though there are other ways-

#re 1 /^TITLE=(.*)/; my $string2 = $1 || ''; print "$string2\n"; #re 2 (my $string3 = $_) =~ s/TITLE=//; print "$string3\n"; # substr my $string4 = substr($_, 6); print "$string4\n";

Just as examples. Which method you choose will depend on what else is going on in your program and what the most general case of your expression is. If it is *always* TITLE="some string" I might use substr. If it was (for example) "some text in upper followed by an equals followed by some string ending in a numeric" *and* I had to ignore other lines that include "=" I might use an regular expression.

--
my $chainsaw = 'Perl';