11月要结束了,汇编考完,没有想象中的好。
哪有那么多时间纠结,不如开始新的旅程吧!
前一段时间Perl开了个头,两周没看,已经快要忘记了,整理一下。
内容是Perl的变量。
#!perl
use strict;
use warnings;
use diagnostics;
#variaty
# $ and @ is sigil
# $ maybe means single
# @ means array
# % means hash
my $nick_name = 'Run_dream';
my @team_mates = ('Hexu','Ganjun','Wuxiaosong');
my $nick = $nick_name;
print "$nick\n";
#instead of using "" and '',we can use q{},qq{};
print qq{$nick\n\n};
#使用当前-结尾模型
my $message = <<"END";
Dear mom,
I am fine.
Sincerely,
Run_dream
END
print $message;
# number
my $answer = 4.39;
print "$answer\n";
print int($answer*100);
# array
my $nine = 9;
my @stuff = (7,'of',$nine);
print "\n",@stuff,"\n";
print "@stuff\n";
print $stuff[0],"\n";
print $stuff[-1],"\n";
# hash
my %people=(
"Alice",1,
"Bob",2,
"Ovid","idoit",
);
my $number = $people{'Bob'};
print "Bob = $number\n";
print "Bob = $people{'Bob'}\n";
$people{Austem}='Jane';
for my $name (keys %people){
print "$name is $people{$name}\n";
}
my %vegetables =(
'celery' => 'yuck',
'spinach'=>'delicoius'
);
#切片
my @num = @stuff[0,-1];
print "@num\n";
my @taste = @vegetables{'celery','spinach'};
print "@taste\n";