Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Getting a base name

by Tanalis (Curate)
on Jul 20, 2005 at 08:31 UTC ( #476415=note: print w/ replies, xml ) Need Help??

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 ..

Comment on Re: Getting a base name
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://476415]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (16)
As of 2015-05-06 09:10 GMT
Find Nodes?
    Voting Booth?

    In my home, the TV remote control is ...

    Results (131 votes), past polls