Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: A few random questions from Learning Perl 3

by blokhead (Monsignor)
on Jan 06, 2003 at 04:52 UTC ( [id://224542]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    {
        my $counter = 0;
        sub inc_counter { $counter++ };    # $counter is visible here
        sub get_counter { $counter };      # and here
    }
    
  2. or download this
    $/ = "\n";
    my $line = <STDIN>;     # <> operator reads just one line
    ...
    }
    
    $line = <STDIN>;        # reads just one line again, since $/ returns 
    +to "\n"
    
  3. or download this
    for (0 .. 100) {
      next unless $_ % 2;     # skip multiples of 2
      next unless $_ % 5;     # skip multiples of 5
      print "$_\n";
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-25 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found