Roman Makurin wrote: > On Wed, Jun 24, 2009 at 04:37:52AM +0200, Gunnar Hjalmarsson wrote: >> Strange. >> >> It looks like strictures and warnings are not enabled (@a and @b are not >> declared). Try to add >> >> use strict; >> use warnings; >> >> and see if that makes Perl give you a hint. >> > > here is complite perl script which produces such results without > any warning:
I don't quite understand why it doesn't work using the while statement, but since I prefer using 'for' when iterating over a list, I went ahead and changed the code. It appears to work after doing so: #!/usr/bin/perl use strict; use warnings; use constant { A => 0, B => 1, C => 2 }; my @a = (A, B, C); my @b = (1, 2, 3); for (@a) { print $_, $/ } for (@b) { print $_, $/ } __END__ pearl# ./constant.pl 0 1 2 1 2 3 Steve
smime.p7s
Description: S/MIME Cryptographic Signature