http://www.perlmonks.org?node_id=1231538


in reply to With substr, index the offset don't get proper start position

#!/usr/bin/perl # https://perlmonks.org/?node_id=1231527 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 ($result) = $line =~ /^(?:\S* ){4}(.*)/; print "$result\n"; print "offset: $-[1]\n";