Re: output "CGI=HASH(0x80ca53c)" ?
[email protected] (prosamper) Mon, 21 Jul 2008 23:42:16 +0530
| Newsgroups | perl.beginners.cgi |
|---|---|
| Message-ID | <[email protected]> |
Curtis Poe wrote: > Oops! Sent this direct instead of to the list :( > > --- Maximilian Ronniger <[email protected]> wrote: >> $out=> $data, > > As Brett pointed out, this line is in error. Try this: > > $out->p( $data ); > > Also, your read_document sub has a slight problem: > >> return $data; >> close SOURCE; > > This should read: > > close SOURCE; > return $data; > > Otherwise, you return from the function without closing SOURCE. > > In the event that you are working on a Windows system, you might want to get in the habit of using > this before you read from the SOURCE filehandle: > > binmode SOURCE; > > Windows has the annoying habit of trying to convert line endings for you. By specifying > 'binmode', you ensure that it reads data exactly as you intended it. It has no effect on Perl > programs written for other operating systems, so it's a safe thing to throw in to make your > program more portable. Here's the new function: > > sub read_document { > local $/; > > open(SOURCE, "<$docoment")|| die "Could not open file!!\n"; > binmode SOURCE; > $data = <SOURCE>; > close SOURCE; > return $data; > } > > Cheers, > Curtis Poe > > ===== > Senior Programmer > Onsite! Technology (http://www.onsitetech.com/) > "Ovid" on http://www.perlmonks.org/ > > __________________________________________________ > Do You Yahoo!? > Get personalized email addresses from Yahoo! Mail - only $35 > a year! http://personal.mail.yahoo.com/ Yes I think he is right