digga has asked for the wisdom of the Perl Monks concerning the following question:

Replies are listed 'Best First'.
Re:
by aquarium (Curate) on Oct 15, 2003 at 23:53 UTC
    assuming that your simple format specs apply, eg. only one bracket set per line.
    while($line=<>) { chomp $line; if (($part1,$part2)=~/(..*)\(..*\)(..*)/) { #now $part1 and $part2 scalars contain *things* before #and after the round brackets found in input print "Part1: $part1\n"; print "Part2: $part2\n"; } }