in reply to Re^6: Perl list items
in thread Perl list items
Dave, thank you you are being very helpful, I am sorry I am quite new to perl and I don't understand it that well yet. Now when i do what you wrote:
my @five_only = @A[0..4]; print @five_only
I still get a list of about 300 numbers and letters does this mean I have to split since i need to make the string into independent items? I already tried that but it would not work this way unfortunately
my @values = split(',', @A); foreach my $val (@values) { d = d + 1); }
That would also be able to count however it seems that does not work, I tried the following just to get a new list of items that does function properly because when i requested te first five items i got a hundred numbers but that neither works since i got this response
<code> my @values = split(',', @A); foreach my $val (@values) { push (@vals, '$vals'); } <code/>HASH(0x100804ed0)$vals
thanks to all you guys for your help, I am unfortunately quite slow in understanding and I have been wanting to write this program a particular time now, that is why i might appear quite impatient, my apologies for that
I am going to read the perlintro and the join split and others tomorrow
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^8: Perl list items
by davido (Cardinal) on Jul 10, 2012 at 07:03 UTC |