"Sureshkumar M (HCL Financial Services)" schreef:

> Can you explain me this part how it's works?
>
>  (?:\d{2}|\w{3})
>
> ?:       what this will do?

Read perlre (and find out what (?:) means).



> And also, the output is like below
>
>
> (C)/tmp/d$ perl 1
> 10-11-81
> 20-NOV-2008
> 05-07-1981
> 15-110-2008   this should not come as this as 3 digit month.
> (C)/tmp/d$

Read perlre (and find out what \w means).


> Program:
>
> (C)/tmp/d$ cat 1
> #/usr/bin/perl
> use strict;
>
> open(DATA,"<a1")||die"Unable to open the file";
> while(<DATA>)
> {
> print if /\b\d{2}\b-(\d{2}|\w{3})-\b\d{2,4}\b/;
>
> }
> close(DATA);
> exit 0;

Compare your program to my version, and study what I changed about it.
Every change had a good reason.


Never fully quote a message, only quote (and summarize) what is relevant
for your reply.
React after each relevant part.

-- 
Affijn, Ruud

"Gewoon is een tijger."


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to