Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: changing a file name, extension not showing up

by TomDLux (Vicar)
on Nov 27, 2012 at 21:14 UTC ( #1005920=note: print w/ replies, xml ) Need Help??


in reply to changing a file name, extension not showing up

Whenever I use a variable within contiguous text, I always delimit it. The '.' should terminate the variable name, because dots are not allowed in variable names. But the delimiter does help the human reader. And of course in situations where underscores are used in variables, you need to delimit to prevent accidents ( we frequently use date/time in file names, at work.)

Using the Perl rename command instead of shelling out is a superior solution. 99% of the time you think you need to shell out to use some standard Unix component, you need to look at the manual.

rename 'fpga_log.txt', $serial . '.txt'; # or maybe rename 'fpga_log.txt', "${serial}.txt";

As Occam said: Entia non sunt multiplicanda praeter necessitatem.


Comment on Re: changing a file name, extension not showing up
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2014-10-26 01:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls