In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Colin Johnstone) writes:
>Gidday all,
>
>I assume when using die in this format I should see the error message.
>
>#!/usr/bin/perl
>
>use CGI qw( :standard );
>
>print header();
>$file1 = /web/schooled/www/news/subscribers_news1.txt
>
>open IN, "<$file1" or die("Cannot Open: $!");
>while( my $record = <IN> ){
>  chomp $record;
>  @data = split( /\|/, $record);
>  $subscribers1{$data[0]} = $data[1];
>}
>close IN;
>
>The program dies but no error prints on the screen.
>
>Where am I going wrong?

Many places, unfortunately.

You don't enable warnings or strictness.  You have at least two syntax
errors in the program (the line assigning to $file1 is not terminated with
a semicolon and there are no quotes around the string).  You don't say 
how you know the program died (when it shouldn't have run at all).  
This appears to be a CGI program yet it does not produce any output after
the header at all.  And you don't say whether you expect to see the error
in the browser or in the server error log file (where it appears depends
on which web server you're using).

Put these lines

        use strict;
        use warnings;

after your first line.  When you've got the program to run properly from 
the command line, you should be closer to getting it to work over the
web.  Make sure you read "Learning Perl" 3rd ed (Schwartz & Phoenix) and
at least one book about CGI programming (e.g., "CGI Programming with Perl",
Meltzer & Michalski).

-- 
Peter Scott
http://www.perldebugged.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to