Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: why won't is print every value???

by Util (Priest)
on Jun 06, 2002 at 00:03 UTC ( [id://172050]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    while (<INFILE>) {
      $word = <STDIN>;
    ...
    
    # Officiate is asked for input on every line of the file.
    # Officiate throttles monk; blacking out, you meditate on your error.
    
  2. or download this
    while (<INFILE>) {
      $line = $_;
    ...
    # $line only contains the last line of the file!
    # Officiate makes bad decision based on wrong output.
    # Monk goes hungry.
    
  3. or download this
    while (<INFILE>) {
      push @lines, $_;
    ...
    # File data is stored until $word is known.
    # Officiate gets correct output, is pleased while file is small.
    # Monk is thrashed when the disk thrashes on a large file.
    
  4. or download this
    $word = <STDIN>;
    while (<INFILE>) {
    ...
    
    # There is no need to store the file data.
    # Harmony is achieved.
    
  5. or download this
    #!/usr/bin/perl -W
    use warnings 'all';
    ...
    }
    my $key = pretty($type);
    print @{ $lines{$key} };
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://172050]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-28 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found