Re: Problems dealing with dates in Windows



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."

.