in reply to Re: Why doesn't the whole line print?
in thread Why doesn't the whole line print?

Yep, I did that and the whole line prints. That's why I'm stumped, it seems as if the regex is clipping the string...
  • Comment on Re: Re: Why doesn't the whole line print?

Replies are listed 'Best First'.
Re: Re: Re: Why doesn't the whole line print?
by blakem (Monsignor) on Aug 18, 2001 at 03:58 UTC
    You'll have to post a bit more code then, because my demo program doesn't suffer from the same problem:

    #!/usr/bin/perl my @current_sentence = qw(so we can do it again yeah yeah); print "current_sentence element: $_\n" for (@current_sentence); $string = "@current_sentence"; print "String Before: $string\n"; if( $string =~ /.*\bso\b.*/ ) { print "String After: $string\n"; }
    OUTPUT

    current_sentence element: so current_sentence element: we current_sentence element: can current_sentence element: do current_sentence element: it current_sentence element: again current_sentence element: yeah current_sentence element: yeah String Before: so we can do it again yeah yeah String After: so we can do it again yeah yeah

    Although I don't really like the $scalar = "@array" construct, I see nothing wrong with it. I would probably use: $scalar = join(' ',@array) instead for clarity.

    -Blake