perl lec4 : lists in perl : Part - 2 | sort | join | split lists explained

preview_player
Показать описание
the video describes the features of lists in perl. How to create or declare a list and then different ways of how to access list elements. In addition, it also explains the sorting, merging and splitting commands which are used in perl very frequently. This is a must watch video.
Рекомендации по теме
Комментарии
Автор

All vedios are helpful ... thank you so much sir ☺️

ranjitamukund
Автор

To sort the list which consists of collections of integer values.
sort() function will consider values in the list as String not the integers values. So sort() function to understand, string to integer values we need to use Space-ship operator i, e. sort {$a <=> $b}.

@no = (5, 4, 3, 2, 1);
print "Original list is : @no\n";
@sorted_no = sort {$a <=> $b} @no;

print "Sorted numbers are: @sorted_no\n";

Output:
Original list is : 5 4 3 2 1
Sorted numbers are: 1 2 3 4 5

faizangokak
Автор

last line should also be

correct me if i am wrong

blueeclouud
Автор

Given the list contains (10, 13, 1, 2, 9), the sorted_number seems to treat all element as string after sort.

willliu
Автор

All videos good but it is speed for beginner

balakannanmc
Автор

I dont understand list with FP at 1:16

viennguyenquoc
Автор

I'm not sure why the code below is not giving sorted output!
Can anyone assist?

@nums = (23, 4, 35, 26, 23, 346, 35);
@sorted_nums = sort @nums;

AnirudhaBehera-lu