Guest User

Untitled

a guest
Oct 20th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.57 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2.  
  3. package n_aryToken;
  4.  
  5. sub new {
  6.  
  7.     my $class = shift;
  8.     my $self = {
  9.  
  10.         _function => shift,
  11.         _arguments => shift
  12.  
  13.     };
  14.  
  15.     bless $self, $class;
  16.     return $self;
  17.  
  18. }
  19.  
  20. sub printAll {
  21.    
  22.     my $self = shift;
  23.     my $delimiter = shift;
  24.  
  25.     $delimiter = " " unless ($delimiter);
  26.  
  27.     my $printString = $self->{_function};
  28.     foreach $arg (@{$self->{_arguments}}) {
  29.         $printString = $printString . " " . $arg . $delimiter;
  30.     }
  31.  
  32.     $printString =~ s/$delimiter$/\n/;
  33.  
  34.     print $printString;
  35.  
  36. }
  37.  
  38. 1;
Add Comment
Please, Sign In to add comment