jerrygarciuh has asked for the wisdom of the Perl Monks concerning the following question:
Is this some sort of default column width formatting?purple :2:blue :1:red :2
_____________________________________________________#!/usr/bin/perl -w use strict; #use Fcntl ':flock'; # import LOCK_* constants use CGI; use CGI::Carp qw/fatalsToBrowser /; my $q = CGI->new(); ######### CONFIG ############# my $results_file ="c:\\windows\\desktop\\survey.poll"; my (%data, @file); ############################## print "Color choice: red, blue, or purple?\n"; my $input = <STDIN>; chomp $input; get_data(); exit; sub get_data { if (-e $results_file){ open (FH, "+< $results_file") or die "where's the damn file? : + $!"; } else { open (FH, "> $results_file") or die "where's the damn file? : +$!"; } #flock (FH,LOCK_EX) or die "Couldn't flock: $!"; $_ = <FH>; chomp; if ($_) { my @file= split(/:/); %data = @file; } $data{$input}++; seek FH, 0, 0; truncate (FH,0) or die "Can't truncate: $!"; @file = join(":",%data); print FH @file; #flock(FH,LOCK_UN); #unlock the file close FH or die "close damn you : $!"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Where are these newlines coming from?
by vladb (Vicar) on Feb 15, 2002 at 20:17 UTC | |
|
Re: Where are these newlines coming from?
by jerrygarciuh (Curate) on Feb 15, 2002 at 20:15 UTC | |
by virtualsue (Vicar) on Feb 15, 2002 at 22:13 UTC | |
|
Re: Where are these newlines coming from?
by Speedy (Monk) on Feb 15, 2002 at 23:50 UTC | |
|
Re: Where are these newlines coming from?
by theguvnor (Chaplain) on Feb 15, 2002 at 20:55 UTC | |
|
Re: Where are these newlines coming from?
by Dog and Pony (Priest) on Feb 16, 2002 at 11:32 UTC |