Except that the output generated is:
Thequickbrown(it'saslightlyreddishbrown)foxjumpsoverthelazydog
However this:
print join "\n", split ' ', "The quick brown (it's a slightly reddish brown) fox jumps over the lazy dog";
does the trick
Perl is Huffman encoded by design.
| [reply] [d/l] [select] |
P:\test>perl -wle"print for split ' ', shift" "The quick brown (it's a
+ slightly reddish brown) fox jumps over the lazy dog
The
quick
brown
(it's
a
slightly
reddish
brown)
fox
jumps
over
the
lazy
dog
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
| [reply] [d/l] |
i always start perl on the commandline with -wle. i would do that even while sleeping.
that saves me from doing "...\n" instead of ... and -w saves me from bugs.
i don't have an alias for that, but i'm typing it automatically. perl -e'' looks very odd to me.
| [reply] [d/l] [select] |
Sorry, but why split if you don't store it and join it directly? I know, it's the homework answer to split, but your's will be more efficient, I guess this way:
s/\s+/\n/;print;
$\=~s;s*.*;q^|D9JYJ^^qq^\//\\\///^;ex;print
| [reply] [d/l] [select] |
Actually I don't think the homework required a split answer. But there is a tradition of providing a somewhat obscure answer to questions that look like homework. If OP asks questions, well and good. If not then they probably can't simply regurgitate the "answers" they have been given and expect to get good marks for it.
Perl is Huffman encoded by design.
| [reply] [d/l] |
The OP asked: "if i want to get a seperate word from tht how will i do that? ". BrowserUKs answer does what he/she asked for. The concatenation of the words is an artefact of the print output used to demonstrate that it works, rather than the operation the OP was asking about.
--------------------------------------------------------------
$perlquestion=~s/Can I/How do I/g;
| [reply] [d/l] |
my @words = split ' ', "The quick brown (it's a slightly reddish brown
+) fox jumps over the lazy dog";
print "$_\n" for @words;
| [reply] [d/l] |
| [reply] [d/l] |