in reply to Confusing warning with if/elsif/else

Why are you blaming strict? Delete use strict and the problem still appears.

The problem is perl's parser/interpretter which doesn't properly record the line number of the various bits of an if. Consider:

#! /usr/bin/perl my $a = "foo"; if ( $a =~ m/aa/ ) { print "hello"; } elsif ( nonexistant() ) { print "hello"; } else { }

Which says

Undefined subroutine &main::nonexistant called at - line 4.

Basically everything in the conditions of an if statement appears to be on the same line as the if.

It sucks but it's a known issue and not likely to be fixed any time soon. If I recall correctly, the way perl currently works, to fix this would mean that each block in the if would require it's own stack frame, which is too much overhead.