in reply to Producing a list of offsets efficiently
#!/usr/bin/perl -w use strict; my $string = "aXbcXdefgXhijXklmnopqrXstuvwXyz"; my $target = "X"; my $count = 0; my @indices = map{$count++;/$target/? $count-1:();}split //,$string; print "@indices"; exit
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Producing a list of offsets efficiently
by tlm (Prior) on May 28, 2005 at 22:00 UTC | |
by japhy (Canon) on May 29, 2005 at 17:11 UTC | |
by tlm (Prior) on May 29, 2005 at 17:57 UTC |