in reply to substitution (s///)

What the error is telling you is that $_ is uninitialized at the line s/\s//g, which is the variable you are doing the substitution on, since you have not given it another (e.g. $variable =~ s/\s//g;

I think what you want is probably stomething like:

if ($line =~ /^%(.{1,100})$/){ $name = $1; $name =~ s/\s//g; #this is the variable I think you want to r +emove spaces from. print "EEEEEEEEEEEEEEEEEEEEEEEEEEEE: $name\n"; } $outfile = "outfile['$name'].txt"; open (OUTFILE, "+>>$outfile");

On a side note unless the spaces will be in the center of the variable $name you might just want to anchor the search to the beginning (using ^)and the end (using $) as it is faster.

-enlil