# New Ticket Created by Colin Kuskie
# Please include the string: [perl #45179]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=45179 >
This patch talks more about the length opcode, and on which kinds of variables
it can be used with. Since there's more PIR code, t/examples/tutorial.t is
updated.
Index: t/examples/tutorial.t
===================================================================
--- t/examples/tutorial.t (revision 21073)
+++ t/examples/tutorial.t (working copy)
@@ -81,6 +81,7 @@
'22_string_ops_length.pir' => << 'END_EXPECTED',
5
+13
END_EXPECTED
'23_string_ops_substr.pir' => << 'END_EXPECTED',
Index: examples/tutorial/22_string_ops_length.pir
===================================================================
--- examples/tutorial/22_string_ops_length.pir (revision 21073)
+++ examples/tutorial/22_string_ops_length.pir (working copy)
@@ -1,6 +1,7 @@
=head1 String Operations (continued)
-To find the length of a string in PIR, use the length function.
+To find the length of a string in PIR, use the length opcode. It works on any
+register register containing a basic Parrot string, but not the String PMC.
=cut
@@ -9,9 +10,13 @@
$S0 = "Hello"
$I0 = length $S0
- print $I0
- print "\n"
+ say $I0
+ .local string text
+ text = "longer string"
+ $I1 = length text
+ say $I1
+
.end
# Local Variables: