Re: Exit subroutine on filehandle error

2011-07-26 Thread Nikolaus Brandt
Hi, On Tue, Jul 26, 2011 at 01:01:54PM +0300, Shlomi Fish wrote: > Hi Nikolaus, > > On Tue, 26 Jul 2011 11:32:19 +0200 > Nikolaus Brandt wrote: > > > Hi, > > > > I'm currently writing a script which contains a subroutine to write > > dat

Exit subroutine on filehandle error

2011-07-26 Thread Nikolaus Brandt
Hi, I'm currently writing a script which contains a subroutine to write data to files. Currently I use open $fh, '>', "$basedir/$userdir/$outfile" or die "Can't write: $!\n"; which has the disadvantage, that the whole script dies if e.g. the userdir is not available. Could you give me an advise