Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: strings with multiple parameters

by starface245 (Novice)
on Nov 07, 2011 at 17:46 UTC ( [id://936549]=note: print w/replies, xml ) Need Help??


in reply to strings with multiple parameters

I went with a different way and use STDIN instead
my $line0 = <STDIN>; my $line1 = <STDIN>; my $line2 = <STDIN>; chomp $line0; chomp $line1; chomp $line2; @strings = ($line0, $line1, $line2);
Now I am trying to write a loop for it and stuck....
print "How many line" my $num = <STDIN>; for ($count = $num; $count>=1; $count--) { my $line; chomp ($line = <STDIN>); }
I am stuck after chomp with STDIN...

Replies are listed 'Best First'.
Re^2: strings with multiple parameters
by toolic (Bishop) on Nov 07, 2011 at 17:51 UTC
    push
    use warnings; use strict; my @strings; print "How many line"; my $num = <STDIN>; for my $count (1 .. $num) { my $line; chomp( $line = <STDIN> ); push @strings, $line; }
      Thank you so much! works perfectly now, I dont know why I didn't think of push...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://936549]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-19 07:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found