Perl Parameter Passing…a ‘1′? December 11 2003
Whats wrong with the following?
#!/usr/local/bin/perl
use strict;
&main();
sub main { test_file(’/etc/passwd’); }
sub test_file {
my $file = @_;
print qq{test_file : $file\n};
}
Why won’t it print ‘/etc/passwd’ ???
(ANSWER: $file must have parens around it)
- Posted in : General
- Author : site admin

Comments»
no comments yet - be the first?