Guest User

Untitled

a guest
Sep 4th, 2018
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. Why is this hash not displaying correctly?
  2. #!/usr/bin/perl
  3. use strict;
  4. use warnings;
  5. use File::Slurp;
  6. use Data::Dumper;
  7.  
  8. my %config;
  9.  
  10. my $text = read_file("./config/settings.cfg");
  11.  
  12. if ($text =~ /^esxi.hosts+=s+(?<host>.+)/xm) {
  13. $config{host} = "$+{host}";
  14. }
  15.  
  16. print Dumper (%config);
  17.  
  18. Connection Options:
  19. ######################################################
  20. esxi.host = server01
  21. esxi.port = 22
  22. esxi.username = root
  23. esxi.password = password
  24. ######################################################
  25.  
  26. Backup Options:
  27. #########################
  28. Compression Options:
  29. 0 = none
  30. 1 = tar
  31. 2 = gzip
  32. 3 = tar+gzip
  33. #########################
  34. backup.compression = 0
  35.  
  36. $VAR1 = 'server01';
  37. $VAR2 = {
  38. 'host' => 'esxi01'
  39. };
  40.  
  41. $VAR1 = {
  42. 'server01' => {
  43. 'host' => 'esxi01'
  44. }
  45. };
Add Comment
Please, Sign In to add comment