in reply to Re: Re: Why doesn't the whole line print?
in thread Why doesn't the whole line print?
OUTPUT#!/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"; }
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
|
|---|