in reply to Question about grep

if (grep(/^$check/,$_)) { is a rather interesting line. In essence it is the equivelent of if (/^$check/) { because there is only one element in the list for grep to work on ($_).

That aside, you need to strip the .zip off before the test, not during the test. One way (there are many) would be:

my $check = 'test.zip'; (my $test = $check) =~ s/\.zip$//; # strip the zip $_ = 'test'; print "match" if /^$test/; # Note no grep - no need

DWIM is Perl's answer to Gödel