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

Re^2: TIMTOWTDI Challenge: Create a filename

by fullermd (Priest)
on Jan 09, 2009 at 02:32 UTC ( [id://735057]=note: print w/replies, xml ) Need Help??


in reply to Re: TIMTOWTDI Challenge: Create a filename
in thread TIMTOWTDI Challenge: Create a filename

Hey!

% which touch /usr/bin/touch

Portability counts! You should make it more robust. Maybe with env...

`echo "#!/usr/bin/env touch $file" > tmp.sh`;

Of course, that's slower at runtime. Extra forks and all. Maybe precalculate it...

`echo "#!\$(which touch) $file" > tmp.sh`;

But really, sh is pretty weak. And we've already got perl anyway, right? So why not use it to its fullest incapacity?

`echo "#!/usr/bin/env perl -e 'system \"\$(which touch) $file\"'" > tm +p.pl`; system './tmp.pl';

Of course, that's getting pretty silly. And tedious. Obviously a little metaprogramming is called for to generate those expressions...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found