#!/usr/bin/perl -wT use strict; use CGI; my $q = new CGI; my $name = $q->param('name'); my $surname = $q->param('surname'); my $sex = $q->param('sex'); my $age = $q->param('age'); my $string = join('|', $name, $surname, $sex, $age); open LOG, ">>messages.txt" or die "Can't open file: $!"; print LOG $string, "\n";; close LOG; #### #!/usr/bin/perl -wT use strict; open LOG, "messages.txt" or die "Can't open file: $!"; while () { chomp; my @attributes = split /\|/; for my $attribute (@attributes) { print $attribute, "\n"; # or do whatever here } } close LOG;