fork download
  1. #!/usr/bin/perl
  2. # your code goes here
  3.  
  4. package MONOLOG;
  5.  
  6. use strict;
  7.  
  8. sub new {
  9. my ( $class, $name ) = @_;
  10.  
  11. my $self = bless { name => $name }, $class;
  12.  
  13. $self->process();
  14.  
  15. return $self;
  16. }
  17.  
  18. sub name {
  19. return $_[0]->{'name'};
  20. }
  21.  
  22. sub process {
  23. my ( $self ) = @_;
  24.  
  25. my $name = $self->name();
  26.  
  27. printf "%s, we are glad to see you!\nSo... how do you think, what do we want to tell you now?\nYes, you right!\n",
  28. $name;
  29. printf "Welcome onboard, %s!!!\n", $name;
  30.  
  31. return $self;
  32. }
  33.  
  34.  
  35. package main;
  36.  
  37. use strict;
  38.  
  39. my $alex = MONOLOG->new('Alex');
  40. my $mike = MONOLOG->new('Mike');
  41.  
Success #stdin #stdout 0s 6044KB
stdin
Standard input is empty
stdout
Alex, we are glad to see you!
So... how do you think, what do we want to tell you now?
Yes, you right!
Welcome onboard, Alex!!!
Mike, we are glad to see you!
So... how do you think, what do we want to tell you now?
Yes, you right!
Welcome onboard, Mike!!!