Advertisement
TermSpar

Perl Basics

Jun 11th, 2016
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.45 KB | None | 0 0
  1. my $hello_world = "Hello World\n";
  2. print($hello_world);
  3.  
  4. ###########################################
  5.  
  6. my $user_name;
  7. print("Enter your name: ");
  8. $user_name = <STDIN>;
  9. chomp($user_name);
  10.  
  11. printf("Hello %s", $user_name);
  12.  
  13. ###########################################
  14.  
  15. my @my_ray = (1,2,3,4,5);
  16.  
  17. for(@my_ray){
  18.   print($_);
  19. }
  20.  
  21. my $first_value = shift @my_ray;
  22. print("\n$first_value");
  23.  
  24. my $last_value = pop @my_ray;
  25. print("\n$last_value");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement