I do not know where it comes from. The script is a nagios check to monitor the updates.spamassassin.org channel:
#!/usr/bin/perl use warnings; use strict; use Mail::SpamAssassin; use Net::DNS; # variables my ( $sa_version, $rev_sa_version, $SA, $update_dir, $version_on_disk, $LOCAL_STATE_DIR, $resolver, $query, $version_dns, $sa_channel ); # get the SpamAssassin version from the Perl module $sa_version = Mail::SpamAssassin::Version(); # reverse this number. We will need it for a txt forware query later $rev_sa_version = join(".", reverse split(/\./, $sa_version) ) ; # sa channel we want to monitor $sa_channel = "updates.spamassassin.org"; # get the local state dir update path $LOCAL_STATE_DIR = '/var/lib/spamassassin'; $SA = Mail::SpamAssassin->new( { LOCAL_STATE_DIR => $LOCAL_STATE_DIR, } ); $update_dir = $SA->sed_path('__local_state_dir__/__version__'); # inside $update_dir, get the line starting with "# UPDATE " # save the version in $version_on_disk if ( -e "$update_dir/updates_spamassassin_org.cf" ) { open (CF, "$update_dir/updates_spamassassin_org.cf" ) or die "$!\n +"; while (<CF> ) { last unless /^# UPDATE\s+[A-Za-z]+\s+(\S+)/; $version_on_disk = $1; } } print "$sa_channel channel version on disk is: $version_on_disk\n"; $resolver = Net::DNS::Resolver->new; $query = $resolver->query("$rev_sa_version.$sa_channel", 'txt'); if ( $query ) { for my $rr ( $query->answer ) { $version_dns = $rr->rdata; } } print "$sa_channel channel dns txt query version is $version_dns\n"; print "[$version_on_disk]\t version on disk\n"; print "[$version_dns]\t version dns\n"; if ( "$version_on_disk" >= "$version_dns" ) { print "OK: the $sa_channel version on disk is up to date: $version +_on_disk\n"; exit 0; } else { print "WARNING: there is a newer version available for SpamAssassi +n $sa_channel rules (on disk version is $version_on_disk, new version + is $version_dns. Run sa-update -D as root to upgrade your SpamAssass +in channel version.\n"; exit 1; }
I added the [] chars around $version_on_disk and $version_dns to make sure no strange characters were coming on the variables. They print correctly on the terminal.

In reply to Re^2: Argument isn't numeric in numeric ge by natxo
in thread Argument isn't numeric in numeric ge by natxo

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.