Advertisement
tyler569

Untitled

Apr 11th, 2013
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.34 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use feature ':5.10';
  4.  
  5. sub arrprint
  6. {
  7.     my $length = @_;
  8.     print "[";
  9.     for ($i = 0; $i < $length; $i++) {
  10.         #Print the value at the place
  11.         print @_[$i];
  12.         #For all BUT the last, add a comma
  13.         if ($i < $length - 1) {
  14.             print ";";
  15.         }
  16.     }
  17.     print "]\n";
  18. }
  19.  
  20. my @arr = split(/,/, <>);
  21. chop @arr[-1];
  22. arrprint @arr;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement