in reply to How to Remove Commas ?
Dear allendevans,
Well that jumps out at me, since there are some very good coding habits for Perl also!
roboticus
showed you the way you should write your code by scoping your variables with 'my' or 'local' or 'our'. If you had 'use strict' as
roboticus had, your script would not compile and you would have the opportunity to write better Perl code. It is not that you pre-defined your variables, but that somehow that makes for better coding habits.
Do you think this code?
is better or more clear than:$date = ""; $time = ""; $ampm = ""; $filesize = 0; $filename = "";
I like that you commented you code very well, but it was that comment above that needs to be changed/improved/removed. This may seem like a nit now, but if you continue to grow with Perl, then learning good Perl coding habits now, will help you in the future.my ($date, $time, $ampm, $filesize, $filename) = split(" ", $line);
Good Luck!
"Well done is better than well said." - Benjamin Franklin
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to Remove Commas ?
by allendevans (Initiate) on Mar 27, 2012 at 13:26 UTC | |
by ww (Archbishop) on Mar 27, 2012 at 14:11 UTC | |
by tobyink (Canon) on Mar 27, 2012 at 16:10 UTC | |
by flexvault (Monsignor) on Mar 27, 2012 at 13:58 UTC |