PilotinControl has asked for the wisdom of the Perl Monks concerning the following question:
Good Morning Esteemed Monks!
My question has to do with auto increments and I think I am missing something very simple as when I add rows to my file the ID should go up by 1 when each new entry is added correct? Please refer to my code below and point me in the right direction as to what I am missing. Thanks in advance!
my $id = 1; my $output="data.txt"; open(DAT,">>$output") || die("Cannot Open File"); print DAT ($id++); print DAT (":"); print DAT ($name); print DAT (":"); print DAT ($number); print DAT (":"); print DAT ($address); print DAT (":"); print DAT ($phone); print DAT (":"); print DAT ($email); print DAT ("\n"); close (DAT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: auto increment
by choroba (Cardinal) on May 05, 2015 at 13:08 UTC | |
by kroach (Pilgrim) on May 05, 2015 at 13:37 UTC | |
by kroach (Pilgrim) on May 05, 2015 at 13:56 UTC | |
by PilotinControl (Pilgrim) on May 05, 2015 at 14:06 UTC | |
|
Re: auto increment
by pme (Monsignor) on May 05, 2015 at 13:30 UTC | |
|
Re: auto increment
by edimusrex (Monk) on May 05, 2015 at 14:39 UTC | |
by choroba (Cardinal) on May 05, 2015 at 15:15 UTC | |
by edimusrex (Monk) on May 05, 2015 at 15:35 UTC |