aixtools has asked for the wisdom of the Perl Monks concerning the following question:
andprint sort(@myarray);
Example@sarray = sort (@myarray); print @sarray;
Output#!/usr/bin/perl # AN ARRAY @coins = ("Quarter","Dime","Nickel"); print "@coins"; print "\n\r"; # ADD ELEMENTS push(@coins, "Penny"); print "@coins"; print "\n\r"; unshift(@coins, "Dollar"); print "@coins"; print "\n\r"; @scoins = sort(@coins); print sort(@coins); print "\n\r"; print "@scoins"; print "\n\r"; # REMOVE ELEMENTS pop(@coins); print "@coins"; print "\n\r"; # BACK TO HOW IT WAS shift(@coins); print "@coins"; print "\n\r";
p.s. the code blocks look really small in my preview. Hope this is normal.Quarter Dime Nickel Quarter Dime Nickel Penny Dollar Quarter Dime Nickel Penny DimeDollarNickelPennyQuarter Dime Dollar Nickel Penny Quarter Dollar Quarter Dime Nickel Quarter Dime Nickel
|
|---|