On Nov 14, Douglas Houston said:
>I am trying to initialize a dynamically-named array, i.e. with the
>following test code (if I type "script.pl char" at the command prompt) I
>get the message "array char contains 1 2 3" but I get a warning if 'use
>strict' is on. Can anyone show me how it should be done (I would like to
>use 'use strict'!)?
You need to explain WHY you want to do this. There doesn't seem to me to
be a good reason. Use a hash of array references. Don't turn off strict.
#!/usr/bin/perl
use strict;
use warnings; # perl5.6+
my %data;
my $name = shift;
$data{$name} = [1,2,3];
# or
# @{ $data{$name} } = (1,2,3);
And your "while (<$ARGV[0]>)" is weird, and not working why you think it
works.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]