70 likes | 163 Views
leqcia 7 miTiTebebi $a1 = 7; $refa1 = $a1; # xisti miTiTeba print $$refa1; # mniSvnelobis aReba # miTiTebiT 7 print $refa1 # daibeWdeba SCALAR(0x < misamarTi >) $refa1 -> $a1; # miTiTeba isriT $refa1 = “a1”; # simboluri miTiTeba. @ masivi = (1,2,3);
E N D
leqcia 7 miTiTebebi $a1 = 7; $refa1 = \$a1; # xistimiTiTeba print $$refa1; # mniSvnelobisaReba # miTiTebiT 7 print $refa1 # daibeWdebaSCALAR(0x<misamarTi>) $refa1 -> $a1; # miTiTebaisriT $refa1 = “a1”; # simbolurimiTiTeba
@masivi = (1,2,3); $refmasivi -> @masivi; print $refmasivi -> [0]; # daibeWdeba 1 @masivi = [1,2,3]; # anonimurimasivi $refmasivi = \@masivi; print $refmasivi -> [0]; # daibeWdeba 1 $ref =\\\\“hello”; print $$$$$ref; # daibeWdebahello $subref = sub {print “hello”}; &$subref; # daibeWdebahello
$a1 = 7; $scalref = *a1{SCALAR}; print $$scalref; # dabeWdavs 7 $a1 = 0; $a1sax = “a1”; $$a1sax = 7; print “$a1”; # daibeWdeba7
@misalmeba = (“gamarjoba”, “salami”, “aqamSvidoba”); foreach my $term (@misalmeba) {*{“print” . $term} = sub{print “$term\n”};} printgamarjoba(); # dabeWdavs - gamarjoba printsalami(); # dabeWdavs - salami printaqamSvidoba(); # dabeWdavs – aqamSvidoba foreach my $term (@misalmeba) {${“print” . $term} = sub{print “$term\n”};} &$printgamarjoba();