Perl中<=>(小于,等于,大于)的含义?

this answer中,我看到了语法< =&gt ;;这是什么意思?它似乎是基于上下文的某种比较,但这是我可以收集的全部内容.部分背景:
sub rev_by_date { $b->[9] <=> $a->[9] }
my @sorted_files = sort rev_by_date @files;

解决方法

Perldoc开始:

Binary “<=>” returns -1,or 1 depending on whether the left argument is numerically less than,equal to,or greater than the right argument. If your platform supports NaNs (not-a-numbers) as numeric values,using them with “<=>” returns undef. NaN is not “<“,“==”,“>”,“<=” or “>=” anything (even NaN),so those 5 return false. NaN != NaN returns true,as does NaN != anything else. If your platform doesn’t support NaNs then NaN is just a string with numeric value 0.

相关文章

1. 如何去重 #!/usr/bin/perl use strict; my %hash; while(...
最近写了一个perl脚本,实现的功能是将表格中其中两列的数据...
表的数据字典格式如下:如果手动写MySQL建表语句,确认麻烦,...
巡检类工作经常会出具日报,最近在原有日报的基础上又新增了...
在实际生产环境中,常常需要从后台日志中截取报文,报文的形...
最近写的一个perl程序,通过关键词匹配统计其出现的频率,让...