#!/usr/bin/perl -w use strict; use Text::CSV; my $csv = Text::CSV->new; open (INPUT,"input.txt") or die "\nCan't open input.txt for reading : $!\n"; open (OUTPUT,">output.txt") or die "\nCan't open output.txt for writing : $!\n"; select OUTPUT; while () { $csv->parse($_); my @IF = $csv->fields(); foreach my $element (@IF) { #printf command goes here } print "\n"; }