in reply to Getting a base name
You need to escape the '.' in your split:
Adding -Mstrict and -w (always a good idea), the following works fine for me:$base = ( split(/\./,$fname) )[0];
Update: And, as others have mentioned, you have single quotes inside single quotes, too :)perl -Mstrict -w -e ' my $fname = "test.txt"; my $base = ( split(/\./,$fname) )[0]; print "$base\n";'
Hope that helps ..
-- Foxcub
#include www.liquidfusion.org.uk
|
---|
In Section
Seekers of Perl Wisdom