Perl/Shell Knowledge Sharing
Perl Interview Questions and Answers
Tuesday, January 4, 2011
perl: pos function
my $s = "I like pie";
for ($i = 0; $i < length($s); $i += 2) {
pos($s) = $i;
$s =~ /\w*/ g;
print "<$&>\n";
}
OUTPUT:
<I>
<like>
<ke>
<>
<ie>
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment