Bismark has asked for the wisdom of the Perl Monks concerning the following question:
credo quia absurdumprint "What is the Part Number that you would like to look up?\n"; my $PartNumber = <STDIN>; chomp($PartNumber); while (!$PartNumber){ ## while $PartNumber is empty keep asking print "PartNumber? "; $PartNumber = <STDIN>; chomp($PartNumber); } &search; #this is the subroutine to search the file sub search{ open(FILE, '>>fai.txt') || die $!; while (<FILE>) { chomp; # remove newline my @fields = split(/\|/, $_); # test whether the search string matches part number if ($fields[0] =~ /$PartNumber/ ) { print "$PartNumber Rev. $Revision has a First Article +Report\nWould you like to view it?"; } }} close(FILE); my $answer = <STDIN>; chomp($answer); if ($answer eq "yes") { print "\n\n\none second please......\n"; print "retrieving file........\n"; <b>error caused by this--></b> print "$fields[0]: $fields[1]: $fields[ +2]: $fields[3]\n"; } # If the answer is no then die else { print "ok, well have a nice day.\n"; }
update (broquaint): s|<(/)?pre>|<${1}code>|g
|
|---|