| grep | length |
| map | length |
| @foo | length (efficiently) |
| keys/values | length (efficiently) |
| split | length, but @_ side-effect |
| |
| (10, 20, 30) | last element |
| @foo[3..5] | last element |
| (10, 20, 30)[2, 1] | last element |
| splice | last element |
| |
| caller | package name (first element of list return) |
| each | key (first element) |
| getpwuid | username (first element) |
| getpwnam | user ID (third element of list return) |
| glob/<*> | "next" item (repeat until undef) |
| gmtime/localtime | printable string (instead of list of components) |
| readline/<HANDLE> | "next" item (repeat until undef) |
| readpipe/``/qx | one item instead of list of lines |
| readdir | "next" item (repeat until undef) |
| reverse | string reverse instead of list reverse |
| select(4-arg) | $nfound (first element of list) |
| sort | undef |
| stat | success value |
| times | $user (first element) |
| unpack | first element |
== # "It's all about context" 번역 ==
* by Randal L. Schwartz
* http://www.stonehenge.com/merlyn/UnixReview/col38.html
최근에 슬래시닷에 올라온 기사에서는 어느 고등학생이 펄 프로그램을 만들다 저지른 작은 실수 때문에 엄청난 곤란을 겪었다는 놀라운 이야기를 다루었다. 그는 동적으로 생성되는 웹페이지에서 다음과 같은 코드를 사용하였다.
{{{#!vim perl
my ($f) = `fortune`;
}}}
그는 다음과 같이 했어야 했다.
{{{#!vim perl
my $f = `fortune`;
}}}
두 코드 다 ''fortune'' 프로그램을 실행하고 그 프로그램이 무작위로 뽑아준 텍스트를 캡처한다. 이번 경우에는 그 학교의 관리자가 학생의 웹페이지를 방문했을 때 ''fortune'' 프로그램은 윌리엄 깁슨의 소설의 한 구절을 보여주었다.