#!/usr/bin/perl # # Syntax: process-isbn-list $converter="/home/douglasr/public-cgi/books/isbn2info"; $filefromname=$ARGV[0]; open( FILE_FROM_HANDLE, "<$filefromname" ); my $tags = ""; while( $line = readline( FILE_FROM_HANDLE ) ) { chomp( $line ); $isbn = $line; if( $line =~ /=/ ) { # print "IS TAG\n"; $tags = $tags."\t$line"; $tags =~ s/$\t(.*)$/$1/; } else { if( ! ( $line =~ /^\#/ ) and ! ( $line =~ /^\s/) ) { $cmdline = "$converter $isbn"; $info = `$cmdline`; chomp( $info ); if(! ( $info =~ /RESULT=NULL/ ) ) { print "$info$tags\n"; } else { # print "IS NULL\n"; } } else { # print "IS COMMENT\n"; } } } close( FILE_FROM_HANDLE ); # EOF