網路管理語言 Perl 入門與實作: | ||
---|---|---|
<<< Previous | 4. Perl 的資料型態 | Next >>> |
由陣列頭部,取出第一個元素:
#! /usr/bin/perl @total=(2, 4, 6, 1, 3, 5, "a", "b", "c"); $first=shift @total; # $first 應為 2 print "$first\n"; print @total; # 此時 @total 應為 (4, 6, 1, 3, 5, "a", "b", "c"); |
<<< Previous | Home | Next >>> |
4.2.6 push | Up | 4.2.8 unshift |