#!/usr/bin/perl -w use strict; use warnings; print "Packaged Goods Organizer\n========================\n"; my %val;my $total=0; DO:{ BAR : print "Barcode : ";$_=<>;chomp;last if ($_ == "0"); if (($_ >= 10000000000)|| ($_ < 1000000000)||/[^0-9]/){ print "Bad input (numbers only and between 1000000000 and 9999999999)\n"; goto BAR; }else{ Price : print "Price : ";$val{$_}{"Price"}=<>;chomp($val{$_}{"Price"}); do{print "Numbers only\n";goto Price} if ($val{$_}{"Price"}=~ /[^0-9\.]/); Quant : print "Quantity : ";$val{$_}{"Quantity"}= <>;chomp($val{$_}{"Quantity"}); do{print "Numbers only\n";goto Quant}if ($val{$_}{"Quantity"}=~ /[^0-9]/); }goto DO; }; print "\n\n\t\tGoods in Stock\n\t\t==============\nBarcode Price Quantity Value\n-----------------------------------\n"; foreach (sort keys %val){ format STDOUT = @<<<<<<<<<<<<<$@<<<<<<<<<$@<<<<<$@ $_, $val{$_}{"Price"}, $val{$_}{"Quantity"}, $val{$_}{"Price"} * $val{$_}{"Quantity"} . write STDOUT; $total += $val{$_}{"Price"} * $val{$_}{"Quantity"}; }close (STDOUT); format STDOUT = <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<$@ "-----" Total value good in stock>>>>>>>$@ $total . write STDOUT;