Oskym has asked for the wisdom of the Perl Monks concerning the following question:
Hi PerlMonkeys!
I'd made a simple script trying to get the final part from a line from the 4th space occurrence.
The Output should be like this:
"GetCertificate](3) Returning context. ID=PTWEBSERVER, Lang=ENG"
Instead of that I'm getting this:
"(6) 01/02/19 06:30:30 GetCertificate(3) Returning context. ID=PTWEBSERVER, Lang=ENG"
Can I ask for help to any expert?
Here is the code:
use strict; use warnings; my $line='PSAPPSRV.26476584 (6) 01/02/19 06:30:30 GetCertificate(3) Re +turning context. ID=PTWEBSERVER, Lang=ENG'; my $SpaceChar = ' '; my $offset = 0; my $result = substr $line,index($line, $SpaceChar, $offset); while ($offset < 4) { $result = substr $line,index($line, $SpaceChar, $offset); print "$result \n"; $offset++; print "offset: $offset \n"; }
Thanks for your help!!
Back to
Seekers of Perl Wisdom