sub substrings { my $string = shift; my @result = (); my $strlen = length $string; foreach my $length (1..$strlen) { foreach my $offset (0..$strlen-$length) { push @result, substr($string,$offset,$length); } } return @result; }
In reply to Re: Finding all substrings
by thelenm
in thread Finding all substrings
by TheHobbit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |