I would guess you really want #!/usr/bin/perl, spaces are meaningful. And a
-w at the end can tell you a lot.
> #! usr/bin/perl
> use strict;
>
> open (FILE_IN, "pslbingocard.dat")|| die "failed to open file\n";
You really want an 'or' here -------^^ not '||'. The operator precedence
can bite you.
> open (FILE_OUT, ">pslbingocard.txt");
>
> $/ = "\n";
You shouldn't need to do this, $/ defaults to '\n'
>
> while (<FILE_IN>) {
> my ($date, $time, $name, $street, $city, $state, $zip,
> $country, $email,
> $phone, $submit, @subscriptions) = split (/|/, $/);
This splits the input record separator on the '|' character, probably not
what you want. I think you really want just 'split /|/;' This will operate
on $_ which is the line you just read in from FILE_IN.
> foreach my $subscription (@subscriptions) { # loop through the
> subscriptions array
> next unless $subscription += 0; #
I might be missing something, but why would this ever succeed? Can't you
always add 0 to something? Are you trying to test for strings? I don't
think this will do it. How about
next unless $subscription =~ /\d+/; # next unless the subscription contains
one or more digits
> next unless $subscription =~ /\s/;
So... Only continue the loop if the subscription contains a space? I'm not
sure why you need this.
> $subscription =~s/^\s+//;
> $subscription =~s/\s+$//;
> $new_data .=
> "$date|$time|$name|$street|$city|$state|$zip|$country|$email|$
> phone|$subscri
> ption|\n"; # create a new line for each bingo number.
> }
> print FILE_OUT $new_data;
> }
>
>
> Crystal
I hope this is helpful,