Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^6: Question on Regular Expression

by Anonymous Monk
on Dec 28, 2014 at 20:33 UTC ( [id://1111587]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Question on Regular Expression
in thread Question on Regular Expression

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1111587]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-24 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found