[mrtg] Perl RegEx question

This is a discussion on [mrtg] Perl RegEx question within the MRTG forums, part of the Networking and Network Related category; I've got the following code (it's part of a larger script to parse Exchange 2007 info into MRTG) ...


Go Back   Usenet Forums > Networking and Network Related > MRTG

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-16-2008
Scott S. Heath
 
Posts: n/a
Default [mrtg] Perl RegEx question

I've got the following code (it's part of a larger script to parse
Exchange 2007 info into MRTG) and I can't seem to get it to output the
right number.

The File it's opening/reading contains: "ReplayQueueLength
: 50"
I expect it to output "50" as the result, but it keeps outputting "5"
and dropping the last 0. When I copy this line into the code and skip
reading it from the file it works fine, when I print the line after
reading it from a file it also works fine.

>From this it looks like it's reading the file fine, and the regex is

correct. What would be causing that last 0 getting dropped off?

===========Begin Code=============


$FileName = "NOAttorney-replayqueuelength.txt";
open(my $REPLAYQUEUEFILE, $FileName) or die "can't open '$FileName'
$!";;
my $ReplayqueueFile = <$REPLAYQUEUEFILE>;
if($ReplayqueueFile =~ m/(\d+)/){
print $1;
$replayQueueLength = $1;
}
print "\n";

===========End Code===============

Any ideas?

Thanks,
Scott

_______________________________________________
mrtg mailing list
mrtg@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:48 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0