|
本公眾號(hào)【讀芯樹:duxinshu_PD】主要介紹數(shù)字集成電路物理設(shè)計(jì)相關(guān)知識(shí),才疏學(xué)淺,如有錯(cuò)誤,歡迎指正交流學(xué)習(xí)。 這是集成電路物理設(shè)計(jì)的第七個(gè)系列【腳本語言】的第十六篇文章,本篇文章主要介紹perl相關(guān)內(nèi)容: 01 — 特殊字符 print 'filename is: '. __FILE__ .'\n'; #打印當(dāng)前文件名字print 'linenum is: '. __LINE__ .'\n'; #打印當(dāng)前行行號(hào)print 'packagename is: '. __PACKAGE__ .'\n'; #打印包文件02 — 數(shù)組
03 — hash hash是key:value對(duì)的集合,以%開頭%week = ('1', 'Monday', '2', 'Tuesday', '3', 'Wednesday');%week = ('1'=>'Monday', '2'=>'Tuesday', '3'=>'Wednesday');print '\$week{'1'} = $week{'1'}\n'; @keys=keys %week;print '@keys\n'; #返回hash所有的keys@value=values %week;print '@value\n'; #返回hash所有的valuesif (exists($week{'3'})) {print '$week{'3'}'} else {print 'no this keys'}@size=keys %week;$num=@size; #hash大小$week{'4'}='Thursday'; #添加新的keys:valuedelete $week{'3'}; #刪除keys的valueforeach $key (keys %week) {print '$week{$key}\n';} #foreach循環(huán)while (($key, $value)=each(%week)) {print '$week($key)\n'} #while循環(huán)04 — 條件語句
05 — 循環(huán) #while循環(huán)$a=0;while ($a<10) { print '$a\n'; $a=$a+1;}#until循環(huán)$a=0;until ($a>9) { print '$a\n'; $a=$a+1;}#for循環(huán)for ($a=0; $a<10;$a=$a+1) { print '$a\n';}#foreach循環(huán)foreach $a (@list=(0..9)) { print '$a\n';}#do-while循環(huán)$a=0;do { print '$a\n'; $a=$a+1;} while ($a<10)#next語句$a=0;while ($a<10) { if {$a==5} { $a=$a+1; next; } print '$a\n'; $a=$a+1;}#last語句$a=0;while ($a<10) { if {$a==5} { $a=$a+1; last; } print '$a\n'; $a=$a+1;}#continue語句$a=0;while ($a<10) { print '$a\n';} continue { $a=$a+1;}#redo語句$a = 0;while($a < 10){ if( $a == 5 ){ $a = $a + 1; redo; } print 'a = $a\n';}continue{ $a = $a + 1;}#goto語句$a = 0;LOOP:do{ if( $a == 5){ $a = $a + 1; goto LOOP; } print '$a\n'; $a = $a + 1;}while( $a < 10 );06 — 參考文獻(xiàn)
|
|
|