Advertisement
harmth

Untitled

Dec 20th, 2018
3,613
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.52 KB | None | 0 0
  1. #!/usr/bin/perl6
  2.  
  3. class foo {
  4.     method bar() {
  5.         return (5,3);
  6.     }
  7.  
  8.     sub bar() {
  9.         return (5,3);
  10.     }
  11.  
  12.     method check() {
  13.         my $a = $.bar();
  14.         say 'method result assigned to $: ' ~ $a.perl;
  15.         my @b = $.bar();
  16.         say 'method result assigned to @: ' ~ @b.perl;
  17.         my $c = bar();
  18.         say 'subroutine result assigned to $: ' ~ $c.perl;
  19.         my @d = bar();
  20.         say 'subroutine result assigned to @: ' ~ @d.perl;
  21.     }
  22. }
  23.  
  24. my $obj = foo.new;
  25. $obj.check();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement