in reply to messing up $line?

Minor code point, to save yourself some typing take advantage of variable interpolation inside double-quoted strings.

my $line = $_; if($line =~ s/^.+\/\.(.*)$/$1/) { print ". extension $line\n"; } elsif ( $line =~ s/^.+\.(.*)$/$1/) { print "Extension $line\n"; }

Note that no interpolation takes place inside single-quoted strings.

Cheers,

JohnGG