You missed some parentheses

#!/usr/bin/perl

use strict;
use warnings;

open(DATA, '<', "data") || die"Unable to open the file";
while(<DATA>) {
        #if($_=~/\d{2}-(\d{2}|\w{3})-\d{1,4}/) {
        if(/(\d{2}-(\d{2})|(\w{3})-\d{1,4})/) {
                print;
        }
}
close(DATA);
exit 0;


On Sat, Nov 29, 2008 at 10:11 AM, Sureshkumar M (HCL Financial
Services) <[EMAIL PROTECTED]> wrote:
> Hi All,
>
>            I try to search the string which has the date format inside
> the file,
>
> But i am not able to get the desired files. Pls help me on this..
>
>
>
>
>
>
>
> C)/tmp/sms/perl$ cat a1
>
>
>
> 115-06-1979
>
> 10-11-81
>
> 20-NOV-2008
>
> 05-07-1981
>
> welcome
>
> 15-10-2008
>
> 12-03-20009
>
>
>
>
>
> (C)/tmp/sms/perl$ cat 1
>
>
>
> #/usr/bin/perl
>
> open(DATA,"a1")||die"Unable to open the file";
>
>
>
> while(<DATA>)
>
> {
>
> if($_=~/\d{2}-(\d{2}|\w{3})-\d{1,4}/)
>
> {
>
> print $_;
>
> }
>
> }
>
> close(DATA);
>
> exit 0;
>
> (C)/tmp/sms/perl$
>
>
>
>
>
>
>
> Output should be  :
>
>
>
> 10-11-81
>
> 20-NOV-2008
>
> 05-07-1981
>
> 15-10-2008
>
>
>
>
>
>
>
>
>
>
>
>



-- 
David Schmidt   |   http://www.fm5.at

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


Reply via email to