#!/usr/bin/perl # ############################################################################ # # $Id: tabdelim-readable.pl,v 1.3 2003/03/28 16:31:24 pete Exp pete $ # ############################################################################ $file = shift; $ct = 0; if ($file eq "") { print "\tusage keyval-readable.pl /path/to/file\n\n"; exit; } open(FILE, "<$file") or die ("Ooops! Could not open $file: $!"); while (defined($line = )) { chomp($line); if ($ct < 1) { @keys = split ("\t", $line); $ct++; next; } @vals = split ("\t", $line); $len = @vals; for ($i = 0 ; $i <= $len ; $i++) { $k = $keys[$i]; $v = $vals[$i]; $k =~ s/\s+$//; $v =~ s/\s+$//; print $k . ":\n" . $v . "\n\n"; } print(("-" x 60) . "\n\n"); undef @vals; $ct++; } close(FILE); $ct--; print "\n$ct records were found\n\n"; __END__ =head1 NAME tabdelim-readable.pl =head1 AUTHOR pete@rasterweb.net =head1 DESCRIPTION This takes a tab delimited file with the first lines being the names of the fields, and does a pretty-print/readable thing with it... =head1 LICENSE This is free software, you may use it and distribute it under the same terms as Perl itself. =cut