I'm trying to execute this simple code but it's already give me the following error :
Use of uninitialized value $string in string at permutation.pl line 11.
#!usr/bin/perl
use strict ;
use warnings ;
sub message {
my ($string) = @_ ;
print "$string" ;
}
message() ;
You didn't pass any arguments to message
, so its @_
is empty, so you assigned undef
to $string
, which results in that warning when $string
is stringified.
Fix:
message("Hello, world\n");