Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: **HomeWork** Printing the found input from an array

by radiantmatrix (Parson)
on Apr 02, 2008 at 14:43 UTC ( #677973=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    foreach my $city ( @myCities ) {
       # $city is local to this loop only!
    }
    
    print "$city";  #there's no $city in scope!
    
  2. or download this
    my $city;  # now is scoped to the whole package!
    foreach $city ( @myCities ) {
    ...
    }
    
    print "$city"; # works as expected!
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://677973]
help
Chatterbox?
[Discipulus]: good morning to the eu community
[davido]: I read a post or two most mornings before diving into code at work but don't post as often anymore... too much going on in life
[Corion]: Hi davido, Discipulus :)
[davido]: Howdy
[davido]: What shall we do about the Google https issue?
[davido]: Probably need to get a cert for the site to maintain our ranking, and update all generated links including in posts to https
[davido]: Make our self-referencing id:// tags generate https links for example

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2018-02-23 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (300 votes). Check out past polls.

    Notices?