Advertisement
Guest User

test1

a guest
Nov 19th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. use strict;
  2. use warnings;
  3.  
  4. my $filename = 'report.txt';
  5. open(my $fh, '>', $filename) or die "Could not open file '$filename' $!";
  6. my %hash;
  7. $hash{"a"}=["nabil", "zizan", "yus"];
  8. $hash{"b"}=["johan", "tokey", "acey"];
  9. $hash{"c"}=["abam", "zoey", "mark"];
  10.  
  11. foreach my $val (values %hash)
  12. {
  13. foreach my $elem (@$val) {
  14. print $fh $elem;
  15. }
  16. }
  17.  
  18. #print $fh "My first report generated by perl\n";
  19. close $fh;
  20. print "done\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement