Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: not able to get the output using split function

by NetWallah (Canon)
on Sep 01, 2012 at 22:09 UTC ( #991201=note: print w/replies, xml ) Need Help??

in reply to not able to get the output using split function

Your code:
my $sentence = shift;
will pick up the FIRST argument passed-in.

Your test probably looked something like:

>perl myprogram i amd testing this.
and it picked-up just the "i".

There are two possible fixes:
1. Add quotes to the argument, like this:

>perl myprogram "i amd testing this."
2. Programattically capture ALL passd arguments:
my $sentence = join " ",@ARGV;
If you notice, @ARGV already contains the same information as @words for this case, so split is unnecessary.

             I hope life isn't a big joke, because I don't get it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991201]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2018-03-21 05:49 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (263 votes). Check out past polls.