Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Declaring a Variable [for BEGINNERS]

by Anonymous Monk
on Dec 27, 2006 at 21:08 UTC ( [id://591939]=note: print w/replies, xml ) Need Help??


in reply to Declaring a Variable [for BEGINNERS]

Hi,
Welcome to Perl!
Delaring variables can be done at the beginning of your program/code or at the point where you being to use those variables in the code.
For example,you may declare varaibles at the beginning of your code as in -
#!/usr/bin/perl use strict; use warnings; my $variable1; my $variable2; ... ... ### Rest of the code follows from below ... ... ### End of the code
Also, if you are declaring variables close to the point where you begin to actually use them, you may do something as below:
#!/usr/bin/perl use strict; use warnings; .... .... ... for (my $variable1=0; $variable1 <= $#someArray; $variable++) { ### Do something here ... ... } ... ### Rest of the code here ...

Best Regards,
garbage777

Log In?
Username:
Password:

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

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

    No recent polls found