Your problem is that you are using exec in the single-argument form, which is a HUGE SECURITY PROBLEM, not to mention that it will have major consequences to your system if your log file contains legitimate commands following a semi-colon. Here is your code:
exec("call_sms_zh.pl -msg=$_");
If we expand $_ to include that line of data, your command expands to this:
exec("call_sms_zh.pl -msg=[Thu Jan 4 07:01:27 2001 1327]ln4p47dbs:Gl +obal_One:new_regext:CRITICAL:Call x84240 Unable to put file; /global1 +/Global120010103.DAT_tmp");
Note the presence of shell metacharacters (specifically, the semi-colon and brackets). The solution is to clean up your exec call:
exec("/path/to/call_sms_zh.pl", "-msg=$_") or die "exec: $!";
This form does not pass your string through any sort of shell, so meta-characters in this fashion are "safe", unless call_sms_zh.pl itself uses them in an unsafe fashion, in which case you're screwed again and need to fix that other script.

If you're using call_sms_zh.pl in a number of scripts, you might be better off turning this Perl script into a real Perl module, and just use that module from within your other scripts. Going a step further, I think there are modules out there in existence for interacting with SMS services, so that might be another option to pursue.


In reply to Re: Reducing a line read into $_ by Fastolfe
in thread Reducing a line read into $_ by locked_user mr_leisure

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.