http://www.perlmonks.org?node_id=476415


in reply to Getting a base name

You need to escape the '.' in your split:
$base = ( split(/\./,$fname) )[0];
Adding -Mstrict and -w (always a good idea), the following works fine for me:
perl -Mstrict -w -e ' my $fname = "test.txt"; my $base = ( split(/\./,$fname) )[0]; print "$base\n";'
Update: And, as others have mentioned, you have single quotes inside single quotes, too :)

Hope that helps ..