I have just started programming Perl I realise that I so I definitely a beginner, but I am hooked.

I have worked with this problem for a couple of weeks, I think I have located the problem but I cant seem to find the solution.

What I want to do is to search trough a large INI like file, in this file there are a section called [Macro] in this section there are reference to a disk. In this case the drive letter is P:, I want to put this into a variable.

Everything works fine if I feed one by one line. But then there are multiple instances in the file that matches. Like I said the problem seems to bee that I try to match the text in an array. But I am not sure. Can anyone please help me, if noting else it would be nice to get some pointers to what I am doing wrong.

open FILE, $file or die "can't read $file: $!"; $/ = ""; # this allows you to read in chunks at a time, where a chunk is data between 2 or more newlines while (<FILE> ) { last if /^\[Macro\].*Value=(.):/s; } close FILE; $drive = $1; </pre><HR></BLOCKQUOTE>

You need the 's' modifier at the end of the regex to allow the '.' to match ALL characters (usually, it won't match \n).

Read up on perldoc perlre, or even perldoc perlretut if you need a tutorial.