in reply to Re: writing to the top of a file
in thread writing to the top of a file

unshift makes it simpler:
#!/usr/bin/perl use strict; use warnings; use Tie::File; my $file = "file.txt"; my $insert = shift @ARGV; chomp $insert; my @lines; tie @lines, 'Tie::File', $file or die $!; unshift @lines, $insert; # more simple, isn't it? untie @lines;
best regards,
neniro