Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

the basic datatypes, three

by root (Scribe)
on Oct 29, 1999 at 01:53 UTC ( #861=perltutorial: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $a=5;
    $b="five";
    $c=5.0
    
  2. or download this
    $a="5.0"; # set up our variables
    $b="5";   # # to the end of a line is a comment in perl
    ...
    print "These variables are equal as strings\n" if($a eq $b);
    print "These variables are equal numerically\n" if($a==$b);
    
  3. or download this
    @a=(1,2,3);
    @simpsonsfamily=("homer","marge","lisa","maggie","bart");
    
  4. or download this
    push @array, $value; #puts $value onto the end of @array.
    
  5. or download this
    @array=reverse @array;
    
  6. or download this
    @array=("key1","value1","key2","value2");   #an array filled with key 
    +value pairs
    %hash1=("key1"=>"value1","key2"=>"value2"); #one way to initialize a h
    +ash (key=>value,key2=>value2,..)
    %hash2=@array;                              #making %hash2 out of a co
    +llection of key value pairs in an array
    $hash3{"key1"}="value1";                    #creates key of "key1" and
    + value of "value1"
    $hash3{"key2"}="value2";
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2014-08-01 15:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (27 votes), past polls