Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by STufaro

  1. STufaro

    Writing Slurped Data Fails

    In terms of output, it's basically not different at all. Correct me if I'm wrong: You described a program which stores no text in a variable but instead prints as it reads it. When Perl reaches the end of the file, <STDIN> returns undefined and you don't print anymore. Then you print the...
  2. STufaro

    Writing Slurped Data Fails

    Good news, actually. I just copied this guy's (a one "Steve Litt") code from a tutorial and modified it slightly: #!/usr/bin/perl -w use strict; open STDIN, "<testpage.txt"; my $hold = $/; undef $/; my $buf = <STDIN>; $/ = $hold; print "Content-Type: text/html "; print $buf; print "\n"...
  3. STufaro

    Writing Slurped Data Fails

    Well, I've brute forced it by putting the HTML directly into the script. But here's my code: # Slurp top file undef $/; $file = "mptop.txt"; open INPUT, "<$file"; $mptop = <INPUT>; close INPUT; print $mptop; And I can't imagine why it's not working. I'm wondering if it has to do with the...
  4. STufaro

    Writing Slurped Data Fails

    Okay. Folks, I understand it now. There are two problems, apparently, with the file I am using. 1) it is too long. (and it's only 496 bytes) 2) it contains new-line characters I've tried both slurping it to a single variable and to an array. Both fail. What am I to do?
  5. STufaro

    Writing Slurped Data Fails

    Determined the cause of the problem but there's no visible way of fixing it. It's because there are new line characters in the file. Perl is being quite the pesky little programming language. I hear line-by-line xfer of text is faster, anyway, so I'm going to try reading it into an array.
  6. STufaro

    Writing Slurped Data Fails

    Okay, I know no one's interested anymore. But I've gotten a step further. It looks to be the file. When I replace the filename with another file in the directory, success. It fails otherwise. The file is called "counter.txt" and contains only the text "91" with no carriage returns/line feeds.
  7. STufaro

    Writing Slurped Data Fails

    It shouldn't matter if I have double-quotes in the textfile, should it? Just a thought. The reason I put it in the textfile is to avoid that and the qq junk.
  8. STufaro

    Writing Slurped Data Fails

    Ah, that doesn't work either. Thanks for the help though, Kevin. The textfile's been in the same directory (though I do tend to make a lot of path mistakes).
  9. STufaro

    Writing Slurped Data Fails

    Update: Oddly enough, when it can't find the file, it prints the rest of it (the middle of the page) correctly. I have a bit of exploring to do.
  10. STufaro

    Writing Slurped Data Fails

    Yes, I've tried that already and still have a blank page. The JavaScript looks okay, though. Could it be that I'm not getting it read into the variable correctly?
  11. STufaro

    Writing Slurped Data Fails

    Hi folks, I'm a bit new to Perl and still am working my way through it, so bear with me. I want to generate webpages. (Of course!) All that changes is the middle of the page. I slurp in the top half of the page like so: undef $/; $file = "mptop.txt"; open INPUT, "$file"; $mptop = <INPUT>...

Part and Inventory Search

Back
Top