Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing multiple array elements

Status
Not open for further replies.

ianfo

Programmer
Aug 20, 2002
29
0
0
GB

Hi,

When using print to display an array element, like this..

print "$myarray[0]\n";

Is it possible to specify a range of elements to print? So instead of just having element 0, I could say elements 0 to 5.

Thanks for any help you can give me.
 
Hi ianfo,



perl -e "@a=(1,2,3,4,5);print qq(@a[2..3]\n)";
3 4

Grant.
 
Just what i'm looking for, thanks....
 

[tt]
@array = ('Value1', 'Value2', 'Value3','Value4','Value5');

print "@array[2..4]\n";[/tt] =================
Bad Company Music
=================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top