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) ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
|
|