#!/usr/bin/perl -w
use strict;
my @array = (1, 2, 3, 4);
my $string;
my $item;
foreach $item(@array) {
&some_sub($item);
}
sub some_sub {
if ($item = "1") {
$string = "one";
}
elsif ($item = "2" ) {
$string = "two";
}
elsif ($item = "3" ) {
$string = "three";
}
else { $string = "four" }
print "My number is $string\n";
}
####
Found = in conditional, should be == at ./testsub.pl line 22.
Found = in conditional, should be == at ./testsub.pl line 19.
Found = in conditional, should be == at ./testsub.pl line 16.
My number is one
My number is one
My number is one
My number is one
####
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
My number is four
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
My number is four
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
My number is four
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
Use of uninitialized value in numeric eq (==) at ./testsub.pl line 16.
My number is four