http://www.perlmonks.org?node_id=207532

cecil36 has asked for the wisdom of the Perl Monks concerning the following question:

I'm rewriting a program that I use occasionally to track UPS shipments and have the status sent to a pager or e-mail address through a program that I use. My previous version used Lynx to fetch the package tracking info and dump the status to a file which was parsed and the pertinent info was sent out. This time, I'm sending out all the data (because of the limitations on hashes and the Business::UPS module. In running my code below on ActiveState Perl on a Win2000 box, I get the following error.

Can't use string "File::CounterFile" as a HASH ref while "strict ref" in use at E:/perl/lib/file/CounterFile.pm line 68.

Code is below
#!/usr/local/bin/perl use Business::UPS; use File::CounterFile; $counter = File::CounterFile->new("./msgid", "00000000"); $id = File::CounterFile->value; $filename = "pagemsg".$id; print "Enter in your UPS package tracking number: "; $track = <STDIN>; chomp($track); print "Enter in the receiver ID or e-mail address of the recipient"; $receiverID = <STDIN>; chomp($receiverID); print "Enter in the name of the messaging service, phone number (no da +shes or special characters), or Internet messaging server address (SN +PP, WCTP, or e-mail server address or IP address)"; $service = <STDIN>; chomp($service); %t = UPStrack("$track"); $t{error} and die "ERROR: $t{error}"; open (FILE, $filename); print FILE "MSG:\n"; print FILE "TO: $receiverID $service\n"; print FILE "CONTENTS: This package is $t{'Current Status'}\n"; # 'Del +ivered' or # 'In-transit' print FILE "Package route\n"; foreach $key (keys %t) { print FILE "KEY: $key = $t{$key}\n"; File::CounterFile->lock(); $counter->inc; File::CounterFIle->unlock(); }