Hi folks
Howdy.
I've got a query about variable initialisation. I want to initialise a list of
variables to an empty string, but I'm having troubles.
What's the best wat to do this?
How about:
my($fred, $ginger) = ('') x 2;
James
If I use the following I get:
[EMAIL PROTECTED] gary]$ cat t #!/usr/bin/perl -w
use strict;
my $fred=$ginger='';
print "fred=$fred\n"; print "ginger=$ginger\n"; [EMAIL PROTECTED] gary]$ ./t Global symbol "$ginger" requires explicit package name at ./t line 5. Global symbol "$ginger" requires explicit package name at ./t line 8. Execution of ./t aborted due to compilation errors. [EMAIL PROTECTED] gary]$
but if I use:
[EMAIL PROTECTED] gary]$ cat t #!/usr/bin/perl -w
use strict;
my ($fred,$ginger)='';
print "fred=$fred\n";
print "ginger=$ginger\n";
[EMAIL PROTECTED] gary]$ ./t
fred=
Use of uninitialized value in concatenation (.) or string at ./t line 8.
ginger=
[EMAIL PROTECTED] gary]$
--
Gary Stainburn
This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]