Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Newbie Question -- Changing File Path?

by azatoth (Curate)
on Jun 25, 2001 at 19:45 UTC ( [id://91316]=note: print w/replies, xml ) Need Help??


in reply to Newbie Question -- Changing File Path?

TIMTOWTDI!

Use Getopt::Long to get the user to enter command line options, i.e. the path.
use Getopt::Long; my %opt = (); GetOptions( \%opt, #general file path "path=s", #file name "file=s", ); my $path = $opt{path}; my $file = $opt{file};
Then, use concatenation to join the $path with the file name!
my $fullFile = $path . $file; unlink($fullFile) or die "$!\n";


Or if we're dealing with an array of files in the same dir :

foreach my $arrayFile(@array) { my $fullFile = $path . $arrayFile; unlink($fullFile) or die "$!\n"; }


HTH

Azatoth a.k.a Captain Whiplash

Make Your Die Messages Full of Wisdom!
Get YOUR PerlMonks Stagename here!
Want to speak like a Londoner?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-03-29 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found