CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [FishMonger] removing all lines that contain the asterisk: Edit Log



goudeuk
Novice

May 12, 2014, 1:55 AM


Views: 8580
Re: [FishMonger] removing all lines that contain the asterisk

Thanks Fishmonger

I tried the following:


Code
my $pwdfile = '/home/perl/files/passwd1.csv'; 
my $list = '/home/perl/list.txt';
my ($FH, $FH2, $username, $password, $fullname);



open $FH , '<', $pwdfile || die "Can't read: '$pwdfile' $!\n";

while (<$FH>)
{
($username,$password,$fullname) = (split /:/)[0,1,4];
print $FH "$username\t$fullname\n" unless $password =~ /\*/ ;
}
close $FH;

open $FH2, '+>', $list || die "Can't write: '$list' $!\n";

print $FH2 $FH;
close $FH2;


Code
 
But my output is: GLOB(0x1d6da68). I think I did what you described in your previous post. I opened one file handle for reading the file, the closed it and then opened a new one to write the changes.


(This post was edited by goudeuk on May 12, 2014, 2:43 AM)


Edit Log:
Post edited by goudeuk (Novice) on May 12, 2014, 2:43 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives