Re: regex extraction problem



tom arnall wrote:
the following code:

$_='abcd';
@f = /(x)(y)|(a)(b)/;

makes the first two cells of '@f' to be undefined, then puts 'a' and 'b' in
the third and fourth cells. how do i get the system to put 'a' and 'b' in the
first two cells and to produce no undefined cells?

@f = grep defined, /(x)(y)|(a)(b)/;


John
--
use Perl;
program
fulfillment
.



Relevant Pages

  • Re: regex extraction problem
    ... On Sunday 28 May 2006 12:20 am, John W. Krahn wrote: ... makes the first two cells of '@f' to be undefined, then puts 'a' and 'b' ... in the third and fourth cells. ... Tom Arnall ...
    (perl.beginners)
  • OT - the empty set and strict and warnings
    ... I tried to post this to the perl misc but nothing happened. ... If one uses warnings and strict then an error message can be generated ... cells and then don't print the * or I don't use strict and warnings. ...
    (comp.lang.perl.tk)
  • Re: QE fails with $ ?
    ... tom arnall wrote: ... but shouldn't \Q \E be sufficient to make perl treat '$' as a literal? ... interpolation of variables happens before the escape sequences so that the ...
    (perl.beginners)
  • Re: CSV Help
    ... Perl knows nothing about CSV. ... Perl is very good at creating data in any given format requirement. ... > If I can maximize the cells through the script to be as big as the largest entry ...
    (perl.beginners)
  • Re: regex extraction problem
    ... makes the first two cells of '@f' to be undefined, then puts 'a' and 'b' ... in the third and fourth cells. ... By programming in Perl for many years. ...
    (perl.beginners)