in reply to regex problem (again)

Use /\S{4}\s(.+)/. I don't understand the (?{length($input);}) part -- it will always true unless $input is the empty string.

BTW, the regexp as given did not match, so $txt did not start with a space.

Replies are listed 'Best First'.
Re^2: regex problem (again)
by uday_sagar (Scribe) on Apr 30, 2012 at 06:45 UTC
    Hi sweepy, Just replace S (upper case) with s (lower case)
    $input = "xxxx aaaa bbbbb"; ($txt) = $input =~ /\s{5}(.+)(?{length($input);})/; chomp; print $txt;
    This is working!
      No, it's not:
      my $input = "xxxx aaaa bbbbb"; my ($txt) = $input =~ /\s{5}(.+)(?{length($input);})/; print $txt, "\n"; __END__ Use of uninitialized value $txt in print at ?? line ??.