Re: date format search insdie the files

2008-11-29 Thread Dr.Ruud
"Sureshkumar M (HCL Financial Services)" schreef: > Can someone help me on this Impossible. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: date format search insdie the files

2008-11-29 Thread Dr.Ruud
"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 >

RE: date format search insdie the files

2008-11-29 Thread Sureshkumar M (HCL Financial Services)
rg Subject: Re: date format search insdie the files "Sureshkumar M (HCL Financial Services)" schreef: > #/usr/bin/perl > open(DATA,"a1")||die"Unable to open the file"; > while() > { > if($_=~/\d{2}-(\d{2}|\w{3})-\d{1,4}/) > { > print $_; > } >

Re: date format search insdie the files

2008-11-29 Thread Dr.Ruud
"Sureshkumar M (HCL Financial Services)" schreef: > #/usr/bin/perl > open(DATA,"a1")||die"Unable to open the file"; > while() > { > if($_=~/\d{2}-(\d{2}|\w{3})-\d{1,4}/) > { > print $_; > } > } > close(DATA); > exit 0; #!/usr/bin/perl use strict; use warnings; my $in_name = "data.in";

RE: date format search insdie the files

2008-11-29 Thread Sureshkumar M (HCL Financial Services)
Hi all , Can someone help me on this From: Sureshkumar M (HCL Financial Services) Sent: Saturday, November 29, 2008 4:21 PM To: 'David Schmidt' Cc: beginners@perl.org Subject: RE: date format search insdie the files Hi David,

RE: date format search insdie the files

2008-11-29 Thread Sureshkumar M (HCL Financial Services)
8 05-07-1981 20-03-20009 15-10-2008 (C)/tmp/d$ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Schmidt Sent: Saturday, November 29, 2008 3:12 PM To: Sureshkumar M (HCL Financial Services); beginners@perl.org Subject: Re: date

Re: date format search insdie the files

2008-11-29 Thread David Schmidt
You missed some parentheses #!/usr/bin/perl use strict; use warnings; open(DATA, '<', "data") || die"Unable to open the file"; while() { #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 S

Re: Date format search in the file

2008-11-22 Thread sftriman
On Nov 22, 6:16 am, [EMAIL PROTECTED] (Dermot) wrote: > 2008/11/22 Sureshkumar M (HCL Financial Services) <[EMAIL PROTECTED]>: > > > > > Hi All, > > Hi > > > > > #!/usr/bin/perl > > # Always use these, particularly when things aren't working as expected. > use strict; > use warnings; > > > open(DAT

Re: Date format search in the file

2008-11-22 Thread John W. Krahn
Dermot wrote: 2008/11/22 Sureshkumar M (HCL Financial Services) <[EMAIL PROTECTED]>: #!/usr/bin/perl # Always use these, particularly when things aren't working as expected. use strict; use warnings; open(DATA,"i")||die "Unable to open the file"; while() { if($_=~/(\d{2})([\W])\1\2\1]/)

Re: Date format search in the file

2008-11-22 Thread John W. Krahn
Sureshkumar M (HCL Financial Services) wrote: Hi All, Hello, I want to find the string which are having the date inside the file. Please help me how do I match it,below is my program and it's not returning anything. #!/usr/bin/perl use warnings; use strict; open(DATA,"i")||die "Unable to

Re: Date format search in the file

2008-11-22 Thread Dermot
2008/11/22 Sureshkumar M (HCL Financial Services) <[EMAIL PROTECTED]>: > > Hi All, Hi > > #!/usr/bin/perl # Always use these, particularly when things aren't working as expected. use strict; use warnings; > open(DATA,"i")||die "Unable to open the file"; > > while() > > { > > if($_=~/(\d{2})([\W

Re: date format

2004-08-17 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: I have this code: my ($month, $day, $year) = (localtime)[4,3,5]; printf ("%02d/%02d/%02d\n", $month+1,$day,$year+1900); which gives me 08/16/2004 what I want is 08/16/04. "perldoc -f localtime" describes very clearly how you get a two digit year. It's advisable to study th

Re: date format

2004-08-16 Thread Flemming Greve Skovengaard
[EMAIL PROTECTED] wrote: I have this value, from the date format solution emails, in a subroutine and I want to pass it to a if clause, how would I go about this? Can I assign a literal such as sub datemanip { my ( $month, $day, $year) = (localtime)[4,3,5]; my $foodate = printf

Re: date format

2004-08-16 Thread Chris Devers
On Mon, 16 Aug 2004 [EMAIL PROTECTED] wrote: sub datemanip A name like that screams a need for the Date::Manip CPAN module: Look over the docs for that module, see if you can't use it to do what you need to do, and let the list know if you

Re: date format

2004-08-16 Thread DBSMITH
02d\n", $month + 1, $day, ($year %100)); } while () if ( $_ =~ $foodate) { . } Flemming Greve Skovengaard <[EMAIL PROTECTED]> 08/16/2004 02:58 PM To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> cc: Bob Showalter <[EMAIL PROTECTED]>

Re: date format

2004-08-16 Thread Flemming Greve Skovengaard
Bob Showalter wrote: Flemming Greve Skovengaard wrote: printf ("%02d/%02d/%02d\n", $month + 1, $day, $year - 100); # Only works when $year > 1999. And when $year <= 2099 :~) Stick to $year % 100; Yes, you are correct. Your solution is fool proof. -- Flemming Greve Skovengaard FAITH, n. a

RE: date format

2004-08-16 Thread Bob Showalter
Flemming Greve Skovengaard wrote: > printf ("%02d/%02d/%02d\n", $month + 1, $day, $year - 100); > # Only works when $year > 1999. And when $year <= 2099 :~) Stick to $year % 100; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: date format

2004-08-16 Thread DBSMITH
7;" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] cc: Subject:RE: date format Bob Showalter wrote: >($year + 1900) % 100 Actually just $year % 100 is valid. The former makes it clearer what you're doing, if you're into that :~)

Re: date format

2004-08-16 Thread Flemming Greve Skovengaard
[EMAIL PROTECTED] wrote: All, I have this code: my ($month, $day, $year) = (localtime)[4,3,5]; printf ("%02d/%02d/%02d\n", $month+1,$day,$year+1900); which gives me 08/16/2004 what I want is 08/16/04. Should I just use Posix with strftime or is there a quicker way w/out having to load the Pos

RE: date format

2004-08-16 Thread Bob Showalter
Bob Showalter wrote: >($year + 1900) % 100 Actually just $year % 100 is valid. The former makes it clearer what you're doing, if you're into that :~) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: date format

2004-08-16 Thread Chris Devers
On Mon, 16 Aug 2004 [EMAIL PROTECTED] wrote: I have this code: my ($month, $day, $year) = (localtime)[4,3,5]; printf ("%02d/%02d/%02d\n", $month+1,$day,$year+1900); which gives me 08/16/2004 what I want is 08/16/04. Should I just use Posix with strftime or is there a quicker way w/out having to lo

RE: date format

2004-08-16 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > All, > > I have this code: > > my ($month, $day, $year) = (localtime)[4,3,5]; > printf ("%02d/%02d/%02d\n", $month+1,$day,$year+1900); > > which gives me > > 08/16/2004 > > what I want is 08/16/04. Should I just use Posix with strftime or is > there a quicker way w/

Re: date format using localtime()

2004-03-12 Thread Owen Cook
On Fri, 12 Mar 2004, Jeff Westman wrote: > Is there a way in perl to get the month/day/year using localtime > WITHOUT using 'use POSIX qw(strftime)' or a system "date" call. > > Something using slices, maybe something like: > > print scalar ((localtime(time))[4,3,7]) > > expecting the re

Re: date format using localtime()

2004-03-12 Thread Steve Mayer
Jeff, Check out http://www.users.voicenet.com/~corr/macsupt/macperl/localtime.html Steve On Fri, Mar 12, 2004 at 01:38:28PM -0800, Jeff Westman wrote: > Is there a way in perl to get the month/day/year using localtime > WITHOUT using 'use POSIX qw(strftime)' or a system "date" call. > > Som

Re: Date format again

2002-03-03 Thread Alfred Wheeler
$year is a number. Numbers do not retain leading zeros. "$year %= 100;" does not return the string "02"; it returns the number 2. Try something like this - $s_year = sprintf("%02u", $year); print "$s_year"; The sprintf function basically converts the number into a string. "sprintf returns a str

Re: Date format again

2002-03-03 Thread Marcelo E. Magallon
[ Don't Cc: me, I read this mailing list, thank you ] >> Troy May <[EMAIL PROTECTED]> writes: > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; > $thisday = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime) [6]]; > $s = (localtime)[0]; > $m = (localtime)[1]; > $m = ($m + 35) ;