in reply to Re: script to listen on a port & redirect to a file
in thread script to listen on a port & redirect to a file

thanks for the quick reply.... so are you saying the script should look like this ?

my $new_sock = $sock->accept(); open my $fh, '>>', $file or die $!; while(<$new_sock>) { print <$fh>; #######close $fh; }

Is this what you mean?

thanks, steve

Replies are listed 'Best First'.
Re^3: script to listen on a port & redirect to a file
by VinsWorldcom (Prior) on Aug 14, 2015 at 19:41 UTC

    I think he means:

    [...] open my $fh, '>>', $file or die $!; while(<$new_sock>) { print $fh $_; } [...]

    Alternatively, just add:

    $|++

    before the "$sock->accept()" call in your original script and the redirect to file will work.