On Tue 18 Mar 2003 00:27, Abigail <abigail@abigail.nl> wrote: > On Mon, Mar 17, 2003 at 11:21:18PM +0100, Rafael Garcia-Suarez wrote: > > > > Hugo asks why the one-liner : > > > > perl -le 'print $a++' > > > > prints "0". Abigail doesn't find this behavior strange, and (as > > expected) has "written code that depends on this". The discussion > > continues. > > > > > Just to avoid people getting the impression I went out of my way > to make use of this behaviour, here's a simple example: > > my $i; > my %months = map {$_ => $i ++} qw /Jan Feb Mar Apr May Jun > Jul Aug Sep Oct Nov Dec/; Written less ambigous as my %month; @month(qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)) = 0..11; Not pretending that this is better, just different, evenly short, but not relying on debatable initial states. -- H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/) using perl-5.6.1, 5.8.0 & 633 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11. Smoking perl CORE: smokers@perl.org http://archives.develooper.com/daily-build@perl.org/ perl-qa@perl.org send smoke reports to: smokers-reports@perl.org, QA: http://qa.perl.orgThread Previous | Thread Next