Sorry I couldnt use 'dd' as I got the below error....if You could provide sample without 'dd' would be muchappreciated.
Fine
#!/usr/bin/perl -- use strict; use warnings; sub dd { use Data::Dumper; print Data::Dumper->new([@_])->Useqq(1)->Dump, "\n"; } Subroutine dd redefined at - line 5. my $cool = qr/ (?<key> \s* (?<key2>\w+) \s* (?<keyQ>\w+) \s* (?<NEVER>\d*) ) /x; my $beans = 'castor cocoa coffee pinto navy Mayocoba'; while( $beans =~ m{$cool}g ){ dd( \%+ ); } __END__ $VAR1 = { "NEVER" => "", "key2" => "castor", "keyQ" => "cocoa", "key" => "castor cocoa " }; $VAR1 = { "NEVER" => "", "key2" => "coffee", "keyQ" => "pinto", "key" => "coffee pinto " }; $VAR1 = { "NEVER" => "", "key2" => "navy", "keyQ" => "Mayocoba", "key" => "navy Mayocoba" };
dd is there for convenience for the example, you don't have to use it in your program, but it is "basic" (see below)
Also this message is obligatory :) Yes, even you can use CPAN, A Guide to Installing Modules, Top 11 (GOOD) reasons not to use someone else's Modules, Top Seven (Bad) Reasons Not To Use Modules
Also, there are checklists for that , Basic debugging checklist , brian's Guide to Solving Any Perl Problem, CGI Help Guide , Troubleshooting Perl CGI scripts
In reply to Re^6: Question on Regular Expression
by Anonymous Monk
in thread Question on Regular Expression
by sjain
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |