On 6/28/07, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
From: "Chas Owens" <[EMAIL PROTECTED]>
> On 6/28/07, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> > From: "Amichai Teumim" <[EMAIL PROTECTED]>
> snip
> > > foreach $elem (@array){
> > > print "$elem\n";
> > > }
> >
> > This
From: "Chas Owens" <[EMAIL PROTECTED]>
> On 6/28/07, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> > From: "Amichai Teumim" <[EMAIL PROTECTED]>
> snip
> > > foreach $elem (@array){
> > > print "$elem\n";
> > > }
> >
> > This can be simplified to
> >
> > print join("\n", @array), "
On 6/28/07, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
From: "Amichai Teumim" <[EMAIL PROTECTED]>
snip
> foreach $elem (@array){
> print "$elem\n";
> }
This can be simplified to
print join("\n", @array), "\n";
snip
or (since this is Perl and TIMTOWTDI)
print map { "$_\n" } @array;
--
To
From: "Amichai Teumim" <[EMAIL PROTECTED]>
> I need to use two loops and an if statement to sort the contents of
> this array so
> that the number go from lowest to highest.
@sorted = sort {$a <=> $b} @unsorted;
You can use the builtin function sort(). All you have to do is to
tell it how do you
I need to use two loops and an if statement to sort the contents of
this array so
that the number go from lowest to highest.
#!/usr/bin/perl
@array = (5,3,2,1,4);
## include your code here ##
foreach $elem (@array){
print "$elem";
}
Looking further into this it was revealed to me that I shou