How do you use map, grep, sort with a short example?

The following example demonstrates how to use the `map`, `grep`, and `sort` functions in Perl.

Keywords: Perl, map, grep, sort, examples, functions
Description: This content provides a short example illustrating the use of map, grep, and sort functions in Perl programming.
# Example of using map, grep, and sort in Perl my @numbers = (3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5); # Using grep to filter numbers greater than 3 my @filtered = grep { $_ > 3 } @numbers; # Using sort to sort the filtered numbers my @sorted = sort { $a <=> $b } @filtered; # Using map to double the sorted numbers my @doubled = map { $_ * 2 } @sorted; print "Filtered, sorted, and doubled numbers: @doubled";

Keywords: Perl map grep sort examples functions