cecil36 has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to get input from a file that has three pieces of information in it, a tracking number, a pager number, and the messaging service the pager is programmed on. The data is on separate lines, as in
Below is how I'm getting the input.tracking number pager number paging service
Here is where I'm generating the output file which a third-party program is going to read as input to generate the message to be sent to the pager. $status is the current status of the package, and $new is the current geographical location of the package when it was last scanned.$datafile = "CheckUPS.in"; open (DATAFILE, $datafile) or die "Input data not found.\n"; while (<DATAFILE>) { $TRACK = $_; chomp ($TRACK); $pager = $_; chomp ($pager); $service = $_; chomp ($service); } print "$TRACK $pager $service\n";
My last output file was# Generate the outgoing notice, and send it if (!($old eq $new)) { open (FILE,">$WORKDIR/$MAILOUT") || die "Could not open file: $!\n +"; print FILE "MSG:\n"; print FILE "TO: $pager $service\n"; print FILE "CONTENTS: Package ID $TRACK is/was $status to $new\n" +; #print FILE "Status: $status\n"; #print FILE "Track#: $TRACK\n"; #print FILE "Old: $old\n"; #print FILE "New: $new\n"; print FILE "\n"; close (FILE); if (($PAGER)) { $PagerCmd = "echo \"Check UPS Tracking: $TRACK\" | $MAILBIN $P +AGER"; system "$PagerCmd"; } #$MailCmd = "cat $WORKDIR/$MAILOUT | $MAILBIN $EMAILS -s \"UPS Pac +kage Tracking: $status\""; #system "$MailCmd"; }
The paging service is listed as the recipient and the package ID number. For some reason, the status and location are not making it into the file as well. What should I check in my code?MSG: TO: Airtouch Airtouch CONTENTS: Package ID Airtouch is/was to
Back to
Seekers of Perl Wisdom