in reply to print number of characters after specific character
You can use index to find a substring in a string. Its third argument tells Perl where to start searching.
#!/usr/bin/perl use warnings; use strict; my $input = "471234973798375754773971832374974447889743725345932"; my $pos = 0; while (-1 != ($pos = index $input, '47', $pos)) { print substr($input, $pos++, 10), "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: print number of characters after specific character
by amparida (Initiate) on Sep 12, 2013 at 23:18 UTC |