Prev: rendering images from a database
Next: Searching regular expr: How to match the following pattern withquotes, brackets and semicolons?
From: Robin on 3 Nov 2009 15:53 How can I place everything the =~ operator has matched into an arrayy? Thank you in advance. peace, -- Robin -- robin1(a)cnsp.com
From: Ben Morrow on 3 Nov 2009 16:42 Quoth "Robin" <robin1(a)cnsp.com>: > How can I place everything the =~ operator has matched into an arrayy? You will need to be more specific about what you want. You might want my @array = $string =~ /pattern/g; but it's hard to be sure. Ben
From: Keith Bradnam on 3 Nov 2009 16:49 On Nov 3, 12:53 pm, "Robin" <rob...(a)cnsp.com> wrote: > How can I place everything the =~ operator has matched into an arrayy? > > Thank you in advance. Do you mean that you want everything that is matched to become the first element of an array? If not, maybe it would help to illustrate the type of data that you are working with? K.
From: Brandon Metcalf on 3 Nov 2009 17:17
On 2009-11-03, Robin <robin1(a)cnsp.com> wrote: > How can I place everything the =~ operator has matched into an arrayy? $ cat jj #!/usr/bin/perl -l use strict; use warnings; my $string = '123aaa'; my ($p1,$p2) = ($string =~ /(\d+)(\w+)/); print $p1; print $p2; $ ./jj 123 aaa -- Brandon |