% cat flatfile.pipe COL1 | someother data|122343221|blahbalhbalh #### % cat flatfile.colon COL1 : someother data:122343221:blahbalhbalh #### % cat splitit.pl #!/sur/bin/perl use Getopt::Std; getopts( 'c:' ); while(<>) { chomp; (@columns) = split /$opt_c/; } foreach $col (@columns) { print "[$col]\n"; } #### % ./splitit.pl -c':' < flatfile.colons #### [COL1 ] [ someother data] [122343221] [blahbalhbalh] #### % ./splitit.pl -c'|' < flatfile.pipes #### [C] [O] [L] [1] [ ] [ ] [ ] [ ] [|] [ ] [s]