This has an OS dependency; I've tested on Solaris, XP, and cygwin, and would be curious to hear if it works on others.
use strict;use warnings;close STDERR&&open STDERR,">",\$_; if($-=(map{++$|,warn$!?$!|=$_:$!=$_,$/}66,55,25,67)?$|:$() {@_=map{substr($_,++$-,++$|)}split$/;print((($^O=~/win/i)? join(undef,@_)^'!/ ?':@_)=>"\!",$/)}
Update: Thank you for the replies! Relying on the error codes was a bad idea. Capturing STDERR was my main point of interest, and below is a better (?) attempt:
use strict;use warnings; {close STDERR&&open STDERR,'>',\$_} print,print[split/\0/,uc^'?25HnL ']->[$|]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: warn("japh!\n"); # ???
by massa (Hermit) on Feb 18, 2009 at 17:11 UTC | |
|
Re: warn("japh!\n"); # ???
by wazoox (Prior) on Feb 18, 2009 at 14:17 UTC | |
|
Re: warn("japh!\n"); # ???
by atemon (Chaplain) on Feb 18, 2009 at 14:56 UTC |