use strict; use warnings; open my $fh, '<', 'an.ini' or die "Failed to open an.ini for reading: +$! <$^E>\n"; my (%settings, $head); while (chomp(my $line = <$fh>)) { if ($line =~ /^\s*\[([^\[\]]+)\]\s*$/) { $head = $1; } elsif ($line !~ /^\s*$/) { push @{$settings{$head}}, $line; } } close $fh; use Data::Dumper; print Dumper \%settings;
In reply to Re^3: Read INI file
by SimonPratt
in thread Read INI file
by bhushanQA
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |