$BJ8;zNs=hM}H!?t(B

last-modified: 29th/July/'01;
since: 1st/June/2001;

$BA0@a$G$O4pK\E*$J%O%C%7%e$N;H$$J}$r8+$F$-$^$7$?!#K\@a$G$O%O%C%7%e$r=hM}$9$k$?$a$KI,MW$JJ8;zNs=hM}$NH!?t$r$^$H$a$F>R2p$7$^$9!#(B

$BJ8;zNsA`:n$N4pK\$O(B$B8!:w$HCV49(B$B$G$9!#=>$C$F!"(B m/.../ $B$H(B s/.../ $B$rMxMQ$9$l$PA4$F

$B$3$l$i$NH!?t$NMxMQ$K47$l$k$H6&$K!"8!:w$HCV49$G$I$N$h$&$K:F8=$9$k$+$b9M$($F$_$k$HJY6/$K$J$j$^$9!#(B

split, join

#$B!Z(Bjoin $B$N4pK\=q<0![(B
$value = join("$B6h@Z$jJ8;zNs(B", $BG[Ns(B);
#join $B$NMxMQNc(B
$value = join(" ]:[ ", a, b, c);	#$value = "a ]:[ b ]:[ c"
#$B!Z(Bsplit $B$N4pK\=q<0![(B
@array = split(/$B@55,I=8=(B/, $BJ8;zNs(B);
#split $B$NMxMQNc(B
@array = split(/:/, "a ]:[ b ]:[ c");	#@array = ("a ]", "[ b ]", "[ c")
@array = split(/ ]:[ /, "a ]:[ b ]:[ c");	#@array = ("a", "b", "c")

$B>\$7$/$O(B$BG[NsA`:n(B$B$r;2>H$/$@$5$$!#(B

chomp

$B2?EY$b;H$C$F$-$^$7$?$,!"J8;zNs$N:G8e$N2~9TJ8;z!J(B\n$B!K$r:o=|$7$^$9!#2~9TJ8;z$,4^$^$l$F$$$J$$>l9g$O2?$b$7$^$;$s!#(B

$BG[Ns$d%j%9%H$KBP$7$F$O!"8D!9$NMWAGA4$F$KBP$7$F(B chmod $B$r:nMQ$7$^$9!#%9%+%i!<%3%s%F%-%9%H$G$O!":o=|$7$?2~9TJ8;z?t$G$9!#(B

$string = "hogehoge\n";
chomp $string;
    #$string = "hogehoge" $B$K$J$k!#(B
    #chomp($string = "hogehoge\n") $B$H$7$F$bF1$8!#(B
@array = ("hogehoge", "foo\n", "hoo", "piyo\n");
$i = chomp @array;
    #@array = ("hogehoge", "foo", "hoo", "piyo") $B$K$J$k!#(B
    #$i = 2 $B$K$J$k!#(B

length

$BJ8;zNs$ND9$5$r%P%$%H?t$GJV$7$^$9!#(B

$B%U%!%$%k$KBP$9$kF~=PNO;~$J$I$K%G!<%?$N%P%$%H?t$r5a$a$F!"$3$N%P%$%H?t$@$1FI$_9~$s$@$iFI$_9~$_$r=*N;$9$k$h$&$K9)IW$9$k$HNI$$$G$7$g$&!#substr $B$d(B $B%Q%?!<%s%^%C%A$J$I$HJ;MQ$7$^$9!#(B

$string = "$B$3$s$K$A$O!#(B";
$size = length $string;
    #$size = 12 $B$K$J$k!#F|K\8l$O(B 2 $B%P%$%HJ8;z!#(B

substr

$BJ8;zNs$NG$0U$NItJ,$NJ8;zNs$rJV$7$^$9!#(B splice $B$HF1MM$KJ8;zNs$rA^F~$9$k$3$H$b$G$-$^$9!#(B

#$B!Z(Bsubstr $B$N4pK\=q<0![(B
$sub_string = substr(string, offset, length);
#$BMxMQNc(B
$string ="I have a dream.";
$a = substr($string, 3, 4);
        #$a = "ave " $B$K$J$k!#(B
$b = substr($string, -4,3);
        #$b = "eam" $B$K$J$k!#(B
$c = substr($string, 0, 6);
        #$c = "I have" $B$K$J$k!#(B
$d = substr($string, 7);
        #$c = "a dream." $B$K$J$k!#(B
substr($string, 9, 0) = "BIG ";
        #$string = "I have a BIG dream." $B$K$J$k!#(B
substr($string, -5,4) = "car";
        #$string = "I have a BIG car." $B$K$J$k!#(B

index, rindex

index $B$O!"J8;zNs$+$i!"%Q%?!<%s$K%^%C%A$9$kItJ,$N:G=i$N0LCV$r%P%$%H?t$GJV$7$^$9!#5U$K!"(B rindex $B$O:G8e$N0LCV$rJV$7$^$9!#(B

#$B!Z(Bindex $B$N4pK\=q<0![(B
$position = index(string, substring, offset);
#$BMxMQNc(B
$position = index("Howdy, world!", "H");
        #$position = 0 $B$K$J$k!#(B
$position = index("Howdy, world", "o");
        #$position = 1 $B$K$J$k!#(B
$position = index("Howdy, world!", "o", 3);
        #3 $B%P%$%HL\0J9_$N(B "o" $B$O(B 8 $B%P%$%HL\$@$+$i!"(B
        #$position = 8 $B$K$J$k!#(B

$BA4$F$NItJ,J8;zNs$r%R%C%H$5$;$k>l9g$O!"(B offset $B$K%+%&%s%H$N$?$a$NJQ?t$r$*$$$F!"(B while $B%k!<%W$5$;$k$N$,NI$$$G$7$g$&!#(B

$Bsubstr, length $B$J$I$HJ;MQ$7$^$9!#(B

Copyright: SUGAI, Manabu. Since: 2001
SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送
FC2> モビット