skyler has asked for the wisdom of the Perl Monks concerning the following question:
print "#! perl -w use strict; #use File::Find; #use File::Copy cp; sub parse_file { my $string1; my $string2; my $string3; my $finstring; open(IN, '<c:/doclist.chr') or die "Couldn't open file, $!"; open(OUT, '>c:/doclist.txt') or die "Couldn't open file, $!"; ## print OUT join '|', split /,/ while <IN>; while(<IN>) { chomp; # Remove the newline my ($var1, $var2, $var3, $var4, $var5, $var6, $var7) = split /, +/; $string1 = $var7; substr($string1, 24) = "H:\"; $string2 = substr($string1,25,2); $string3 = substr($string1,-13); $finstring = $string1.$string2.$string3; print OUT "$var1,"|",$var2,"|",$var3,"|",$var4,"|",$var5,"|",$v +ar6,"|",$finstring," \n"; } exit; } \n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Open file & Strip comma delimiter
by graff (Chancellor) on Feb 16, 2003 at 23:41 UTC | |
|
Re: Open file & Strip comma delimiter
by tachyon (Chancellor) on Feb 16, 2003 at 23:33 UTC | |
|
Re: Open file & Strip comma delimiter
by tachyon (Chancellor) on Feb 16, 2003 at 23:29 UTC | |
by skyler (Beadle) on Feb 17, 2003 at 00:44 UTC | |
by tachyon (Chancellor) on Feb 17, 2003 at 02:42 UTC | |
by skyler (Beadle) on Feb 17, 2003 at 04:08 UTC | |
by tachyon (Chancellor) on Feb 17, 2003 at 05:28 UTC | |
|
Re: Open file & Strip comma delimiter
by dws (Chancellor) on Feb 16, 2003 at 23:21 UTC |