in reply to Does a foreach create a scalar reference?
This behaviour is described in the third paragraph of the Foreach Loops section of the perlsyn document.
But perhaps it would be simpler to use sprintf to add leading zeros to your numeric fields:
my ( undef, $m, $h, $dy, $mo, $yr ) = localtime; print sprintf "%d-%02d-%02d %02d:%02d\n", $yr + 1900, $mo + 1, $dy, $h +, $m;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Does a foreach create a scalar reference?
by Fletch (Bishop) on May 26, 2009 at 19:38 UTC |