in reply to Perl Problems with Matching Expression Patterns

my @DATA = ( ' date : "April 27, 2004";', ' comment : "Copyright (c) 2002 FoodNation Technolo, Inc. ";', ' power_watts : "1pC";', ' fruits_vegs_food (1.0, pound);' ); my $inline; foreach $inline (@DATA) { my ($f, $s); if ( $inline =~ m/\s+(\w+)\s+:\s+"?([^"]+)"?/ ) { print "FIRST TERM - $1\n"; print "SECON TERM - $2\n"; } elsif ( $inline =~ m/\s+(\w+)\s+\(([^\)]+)\)/ ) { print "FIRST TERM - $1\n"; print "SECON TERM - $2\n"; } }
hint: never, never use ".*" when you donīt need because ".*" matches also ""