in reply to Seeking and Printing
Here's one way to do it, using Tie::File. A couple of caveats:
#! /usr/bin/perl use strict ; use warnings ; $|++ ; use Tie::File ; my $datafile = 'test_a.dat' ; my $username = 'terry' ; my $req_addr = 'tag@foo.com' ; my ( $name, $domain ) = $req_addr =~ /^([\w.-]+)(@[\w.-]+)$/ ; tie my @virtual, 'Tie::File', $datafile or die $! ; my $row = 0 ; $row++ until $virtual[$row] =~ $domain ; $virtual[$row] .= "\n$req_addr\t$username\n" ; untie @virtual ; __END__
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
--Friedrich Nietzsche
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Seeking and Printing
by jimbobn (Novice) on Aug 14, 2002 at 18:04 UTC | |
by DamnDirtyApe (Curate) on Aug 14, 2002 at 18:21 UTC | |
by jimbobn (Novice) on Aug 14, 2002 at 19:15 UTC |