#!/usr/bin/perl -- sub hex_to_ascii ($) { # Convert each two-digit hex number back to an ASCII character. (my $str = shift) =~ s/([a-fA-F0-9]{2})/chr(hex $1)/eg; return $str; } chdir( "inboundd/" ); local( @files ) = <*.dat>; if($files[0] ne ""){ $GetFile = $files[0]; @FileHeader = split("_",$GetFile); if($FileHeader[0] eq "DN"){ system "cp $GetFile ../DN_Dump/"; unlink($GetFile); } else{ open (CHECKBOOK, "$GetFile") || die "couldn't open the file!"; while ($record = ) { $InString .= $record; } close(CHECKBOOK); system "cp $GetFile ../MO_Dump/"; unlink($GetFile); } } chdir("../"); # GETTING THE FILE OUT AND FORM MO #print "The MO Received $InString \n"; if($InString ne ""){ @InArrData = split(",",$InString); $InMobile = $InArrData[1]; $InShortcode = $InArrData[6]; $InVendor = $InArrData[7]; $InMsgHex = $InArrData[5]; $InKeyword = $InArrData[10]; $InInbound = $InArrData[9]; $InMsg = &hex_to_ascii($InMsgHex); $InAnswer = "mo:$InMobile:$InShortcode:$InInbound:$InVendor:$InMsg\n"; } print $InAnswer;