in reply to The last occurrence
#!/usr/bin/perl -w use strict; { local $/ = ""; while(<DATA>) { my($word, $string) = $_ =~ /.*(\b\w+)\s*(\(.*\))/s; print "\$word: $word\n"; print "\$string: $string\n"; } } __DATA__ SMSG(could be anything here.) SMSG(And more then one occurrence. And the following @ symbol is sometimes missing) @ JOB2 (AGE=42, NAME=Robert, DATE=@TODAY)
|
|---|