Perl Reading A File

By ET

Read from a file, and write out. Just put it here for my own reference.

#!/usr/bin/perl

$data_file=”file.csv”;

open(DAT, $data_file) || die(“Could not open file!”);
@raw_data=;
close(DAT);

#print “Content-type: text/html\n\n”;
#print “”;

foreach $lines (@raw_data)
{
chomp($lines);
($var1,$var2,$var2)=split(/\|/,$lines);
print “$var1,$var2,$var3\n”;
# print ”
\n”;
}

#print “”;

Leave a Reply


BlogTimer
You are visitor number several since September 1, 2001

Copyright Xiaoquan (Michael) Zhang, 2004-2010. All rights reserved.
All trademarks property of their owners.