cyberconte has asked for the wisdom of the Perl Monks concerning the following question:
Is there a way to combine the two regexps? for example, something likemy $string = '12 abcdefghijklmnopqrstuvwxyz'; my ($len) = ($string =~ /^(\d+)/; my ($substring) = ($string =~ /^\d+ (.{$len})/); print "$substring\n";
(except we know that doesn't work)? Having it all on one line in one regexp is the goal...my ($len,$substring) = ($string =~ /^(\d+) (.{$1})/);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using previous match in the same matching regexp
by GrandFather (Saint) on Nov 16, 2005 at 22:48 UTC | |
|
Re: Using previous match in the same matching regexp
by Roy Johnson (Monsignor) on Nov 16, 2005 at 23:04 UTC | |
by Anonymous Monk on Nov 16, 2005 at 23:17 UTC | |
|
Re: Using previous match in the same matching regexp
by ikegami (Patriarch) on Nov 16, 2005 at 23:10 UTC | |
|
Re: Using previous match in the same matching regexp
by japhy (Canon) on Nov 17, 2005 at 03:57 UTC |