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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.