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


In reply to Re: Re: Re: Why doesn't the whole line print? by blakem
in thread Why doesn't the whole line print? by hillard

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.