use Config::IniFiles; my $smb = new Config::IniFiles( -file => '/etc/samba/smb.conf'); print join $/, $smb->Sections; # prints the section names