in reply to Easy way to check if a file is open needed.
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; open my $OUT, '>', '1' or die $!; my $child = fork; if ($child) { sleep 1; my %new_name = map +($_ => $_ + 1), 1 .. 8; for my $old (1 .. 8) { rename $old, $new_name{$old} or die $!; say "$old renamed to $new_name{$old}."; sleep 1; } exit } defined $child or die "Can't fork"; for (1 .. 10) { say {$OUT} $_; say "Printed: $_."; sleep 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Easy way to check if a file is open needed. -- MSWin32
by Discipulus (Canon) on Apr 09, 2019 at 07:06 UTC | |
by choroba (Cardinal) on Apr 09, 2019 at 07:35 UTC | |
|
Re^2: Easy way to check if a file is open needed.
by Apt_Addiction (Novice) on Apr 09, 2019 at 09:22 UTC |