Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
more useful options
 
PerlMonks  

Re: Declaring a Variable [for BEGINNERS]

by Anonymous Monk
on Dec 27, 2006 at 21:08 UTC ( #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


Comment on Re: Declaring a Variable [for BEGINNERS]
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-04-21 05:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (491 votes), past polls