Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: ideas on how to improve existing code

by Anonymous Monk
on Aug 29, 2011 at 09:02 UTC ( [id://922959]=note: print w/replies, xml ) Need Help??


in reply to ideas on how to improve existing code

It is not clear why you are diddling the data, what you call "format the columns", so why are you? You should do that after parsing into cvs, not before

Somehow I have a feeling that this code is not efficient but it works.

Thats just gas, don't worry about it

Is it worth to improve it or just use it as it is?

The code is literally 20 lines, there is nothing to improve

The only possible thing is use "modern perl" practices, meaning use 3 argument open, and lexical filehandle, and maybe use autodie because the error message is better

$ perl -Mautodie -le " open my $fh => '<', '23232' " Can't open '23232' for reading: 'No such file or directory' at -e line + 1

Replies are listed 'Best First'.
Re^2: ideas on how to improve existing code
by trolis (Novice) on Aug 29, 2011 at 09:31 UTC
    Thanks for reply and comments.

    My initial goal is to set up those files to the default format which gnuplot accepts (space delimited columns of data with a dot as decimal separator). I have many csv files which all look slightly differently so the idea was to make them all "the same". For sure there could be many other ways to complete the task but somehow I have chosen Perl. The script should grow over time as I plan to implement more features but I have just started.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-24 07:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found