Re: Problems dealing with dates in Windows
- From: "Dr.Ruud" <rvtol+news@xxxxxxxxxxxx>
- Date: Sat, 3 Feb 2007 13:02:36 +0100
Ayaz Ahmed Khan schreef:
"GGelz":
$date = localtime(time);
printing $date gives
"Fri Feb 2 12:23:11 2007"
now, if I split it using
($day, $month, $monthday, $time, $year) = split(/\s/, $date);
You need '\s+' in there to cause split() to split on any number of
consecuteive whitespaces.
Often the special ' ' does even more what one expects, because it skips
leading whitespace too, see `perldoc -f split`.
$ perl -wle '@x = split /\s+/, q{ a b c }; print scalar @x'
4
$ perl -wle '@x = split q{ }, q{ a b c }; print scalar @x'
3
--
Affijn, Ruud
"Gewoon is een tijger."
.
- Follow-Ups:
- Re: Problems dealing with dates in Windows
- From: Ayaz Ahmed Khan
- Re: Problems dealing with dates in Windows
- References:
- Problems dealing with dates in Windows
- From: GGelz
- Re: Problems dealing with dates in Windows
- From: Ayaz Ahmed Khan
- Problems dealing with dates in Windows
- Prev by Date: Re: Simple REGEX
- Next by Date: Re: perl one liner to remove all but the base file name
- Previous by thread: Re: Problems dealing with dates in Windows
- Next by thread: Re: Problems dealing with dates in Windows
- Index(es):