harishnuti has asked for the wisdom of the Perl Monks concerning the following question:
# reading a text file delimited by ! while (<FILE>){ my @array = split(/\!/,$_); #to my surprise $array[10] field may #have leading zeros, #for ex:- 00090,00089,003 etc $str = join(",",@array); print FILE $str ; # iam writing this to some file #i figured one approach as below. $array[10] = qq~="$array[10]"~; #i havent tested in code , but manually #when i prepended = and including element #in double quotes worked #now when i open csv in excel i can #see leading zeros #just like a formula ="place your element here" #pls let me know if any better #approach to achive above
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Retaining leading Zeros in csv file
by Tux (Canon) on Jul 02, 2008 at 07:48 UTC | |
by psini (Deacon) on Jul 02, 2008 at 08:40 UTC | |
by harishnuti (Beadle) on Jul 02, 2008 at 15:13 UTC | |
|
Re: Retaining leading Zeros in csv file
by igelkott (Priest) on Jul 03, 2008 at 18:48 UTC | |
|
Re: Retaining leading Zeros in csv file
by Anonymous Monk on Dec 31, 2008 at 05:32 UTC |