Background: I am new to Perl and I am tinkering with a simple script that loops through a hash value that is an anonymous array.
The Issue I cannot seem to loop through the array. All I get is ARRAY(0x1663b78)
The Code
#!/usr/bin/perl
package Foo;
use strict "vars";
sub new {
my $class = shift;
my $self = {
distro => "",
pkg_mgr => "",
options => ["PHP + Apache", "PHP + Lighthttpd", "PHP + Nginx", "RubyGems + Rails", "Node JS + NPM"]
};
bless $self, $class;
return $self;
}
sub print_options {
my($self) = @_;
foreach($self->{options}) {
print $_ . "\n";
}
}
my $setup = new Foo();
$setup->print_options();
Also, if someone could kindly inform me if it's remotely useful to use use strict "vars";
if I really have no need for private or public variables. I know how I would do this in PHP but I can't wrap my head around this in Perl.
Lastly, my reason for using Perl is because eventually I'm going to make an application that installs software for servers (including PHP). This script will require user interaction via command line.