$thumbName = ($thumbName =~ /^([-\@\w.\/]+)$/) ? $1 : undef; if($thumbName) { open( NEWIMG, "+>$thumbName" ) or croak "Can't open new imagefile: ($thumbName) $! \n"; }