Documentation for routine perl

Documentation for routine perl, assembled from the following types:

class Mu

From Mu

(Mu) routine perl

multi sub    perl(Mu --> Str)
multi method perl(   --> Str)

Returns a Perlish representation of the object (i.e., can usually be re-evaluated with EVAL to regenerate the object). The exact output of perl is implementation specific, since there are generally many ways to write a Perl expression that produces a particular value

class Complex

From Complex

(Complex) method perl

Defined as:

method perl(Complex:D: --> Str:D)

Returns a string representation corresponding to the unambiguous val()-based representation of complex literals, of the form "<1+2i>", without internal spaces, and including the angles that keep the + from being treated as a normal addition operator.

say (1-3i).perl;                # OUTPUT: «<1-3i>␤» 

class IO::Path

From IO::Path

(IO::Path) method perl

Defined as:

method perl(IO::Path:D: --> Str:D)

Returns a string that, when given passed through EVAL gives the original invocant back.

"foo/bar".IO.perl.say;
# OUTPUT: IO::Path.new("foo/bar", :SPEC(IO::Spec::Unix), :CWD("/home/camelia")) 

Note that this string includes the value of the .CWD attribute that is set to $*CWD when the path object was created, by default.

class IO::Path::Cygwin

From IO::Path::Cygwin

(IO::Path::Cygwin) method perl

Defined as:

method perl(IO::Path::Cygwin:D: --> Str:D)

Returns a string that, when given passed through EVAL gives the original invocant back.

IO::Path::Cygwin.new("foo/bar").perl.say;
# OUTPUT: IO::Path::Cygwin.new("foo/bar", :CWD("/home/camelia")) 

Note that this string includes the value of the .CWD attribute that is set to $*CWD when the path object was created, by default.

class IO::Path::QNX

From IO::Path::QNX

(IO::Path::QNX) method perl

Defined as:

method perl(IO::Path::QNX:D: --> Str:D)

Returns a string that, when given passed through EVAL gives the original invocant back.

IO::Path::QNX.new("foo/bar").perl.say;
# OUTPUT: IO::Path::QNX.new("foo/bar", :CWD("/home/camelia")) 

Note that this string includes the value of the .CWD attribute that is set to $*CWD when the path object was created, by default.

class IO::Path::Unix

From IO::Path::Unix

(IO::Path::Unix) method perl

Defined as:

method perl(IO::Path::Unix:D: --> Str:D)

Returns a string that, when given passed through EVAL gives the original invocant back.

IO::Path::Unix.new("foo/bar").perl.say;
# OUTPUT: IO::Path::Unix.new("foo/bar", :CWD("/home/camelia")) 

Note that this string includes the value of the .CWD attribute that is set to $*CWD when the path object was created, by default.

class IO::Path::Win32

From IO::Path::Win32

(IO::Path::Win32) method perl

Defined as:

method perl(IO::Path::Win32:D: --> Str:D)

Returns a string that, when given passed through EVAL gives the original invocant back.

IO::Path::Win32.new("foo/bar").perl.say;
# OUTPUT: IO::Path::Win32.new("foo/bar", :CWD("C:\\Users\\camelia")) 

Note that this string includes the value of the .CWD attribute that is set to $*CWD when the path object was created, by default.

class Rat

From Rat

(Rat) method perl

multi method perl(Rat:D: --> Str:D)

Returns a string representation corresponding to the unambiguous val()-based representation of rational literals. If the number can be represented exactly in decimal, it will be. Otherwise uses the form "<3/5> ", without internal spaces, and including the angles that keep the / from being treated as a normal division operator.

say (1/3).perl;                # OUTPUT: «<1/3>␤» 
say (2/4).perl;                # OUTPUT: «0.5␤»