EchoAngel has asked for the wisdom of the Perl Monks concerning the following question:
this isn't what i expected as output . this is the output :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) { if ($inline =~ m/\s*(\w+)\s*:*\"*\(*\s*([\S\s]+)\"*\)*;*/) { print "FIRST TERM - $1\n"; print "SECON TERM - $2\n"; } }
what i really wanted wasFIRST TERM - date SECON TERM - "April 27, 2004"; FIRST TERM - comment SECON TERM - "Copyright (c) 2002 FoodNation Technolo, Inc. "; FIRST TERM - power_watts SECON TERM - "1pC"; FIRST TERM - fruits_vegs_food SECON TERM - 1.0, pound);
do u know what's wrong with my matching expressions?FIRST TERM - date SECON TERM - April 27, 2004 FIRST TERM - comment SECON TERM - Copyright (c) 2002 FoodNation Technolo, Inc. FIRST TERM - power_watts SECON TERM - 1pC FIRST TERM - fruits_vegs_food SECON TERM - 1.0, pound
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Problems with Matching Expression Patterns
by Eimi Metamorphoumai (Deacon) on Jan 12, 2005 at 21:11 UTC | |
by EchoAngel (Pilgrim) on Jan 12, 2005 at 21:17 UTC | |
|
Re: Perl Problems with Matching Expression Patterns
by Zaxo (Archbishop) on Jan 12, 2005 at 21:15 UTC | |
by holli (Abbot) on Jan 12, 2005 at 21:42 UTC | |
|
Re: Perl Problems with Matching Expression Patterns
by holli (Abbot) on Jan 12, 2005 at 21:33 UTC |