-----Original Message----- >From: Aruna Goke <[EMAIL PROTECTED]> >Sent: Aug 5, 2007 12:39 PM >To: [email protected] >Subject: working with regexp without escaping range symbol > >hello all, > >How can I work with this kind on expression without escaping the range. > >#!/usr/bin/perl > >use warnings; >use strict; >use DateTime; > >my $ystd = DateTime->today->subtract(days => 1); >my $mdy = $ystd->ymd('-'); #date format in 09-25-2007 >my $dty = $ystd->mdy(''); #date in format 09252007 >{ >my ($sum, $newsum_b, $sum_b, $cnt_ans, $cnt_nans); > open my $fh, '<', $mfile or die "open '$mfile': $!" ; > open my $nfh, '>', $yfile or die "open '$yfile': $!" ; > while (<$fh>){ > if(/$ystd/){ > cdr_proc(); >} > > >if I used the date 2007\-08\-04, it will work.. but I want to work with >the regexp without escaping the -. >
You may need quotemeta function.See perldoc -f quotemeta for details. -- Jeff Pang <[EMAIL PROTECTED]> http://home.arcor.de/jeffpang/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
