Thursday, October 20, 2022

Sorting array of strings in perl

 

#defining and array
@fruits = ('Rasberry', 'Orange', 'Apricot','Banana', 'Apple','Olive' );

@fruits = sort(@fruits); #applying the sort function
print("@fruits"); #printing the sorted array

No comments:

Post a Comment