Vizible’s Blog

Perl – Example Data Types

Posted in perl by wearetherock on August 26, 2009

1. Scalar
=============================

$first_name = "Wearetherock";
$last_name= "Ok";
$salary = 20;
print $first_name, $last_name, $salary;

~
2. Array
=============================

@names = ("Java", "C", "Python", "Perl");
print "@names";
print "$names[0] and $names[2]";
print "$names[-1]\n";
$names[4] = "Lisp";

function : pop, push, shift, unshift, splice, sort

~
3. Hash
=============================

%employee = (
	"Name" => "Wearetherock",
	"Phone" => "119",
	"Position" => "ZEO"
);
print $employee{"Name"};
$employee{"SSN"} = "9999-0000-5555";

function : keys, values, each, delete

~

Advertisements

One Response

Subscribe to comments with RSS.

  1. wk said, on November 15, 2010 at 4:15 pm

    Spam กล่องกระดาษ http://www.scpaperpack.co.th


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: