Quick jump:  What's new

 
Go to:
 
Weblog: Recent Changes 
in Hackathon Chicago, Nov 10-12, 2006
Perl::Critic

Leader: Chris Dolan (Attending Saturday only)
Interested: Andy Lester
Interested: Elliot Shank
Interested: Michael R. Wolf

Perl::Critic is an extensible framework for creating and applying coding standards to Perl source code. Essentially, it is a static source code analysis engine, like lint for C. New policies are getting added to Perl::Critic all the time, and you can help your fellow Perl programmers write cleaner, safer code.

http://perlcritic.tigris.org/

Getting Started

Before the hackathon, you should download the latest Perl::Critic from our SVN repository, and install all of its prerequisites:

% cpan install Perl::Critic
% svn checkout http://perlcritic.tigris.org/svn/perlcritic/trunk perlcritic

Username: "guest"
Password: "" (blank)

How to help

You don't have to actually know Perl::Critic or PPI's internals to help out. Most of the work is writing test cases and thinking through the logic of matching Perl code.

You can (in order from easiest to hardest):

  • Choose good policies to implement
  • Write some positive and negative tests
  • Come up the corner cases.
  • Write pseudo-code and docs
  • Write the PPI implementation of pseudo-code
  • Hack PPI

Items to-do

Here are a few Policy ideas from our TODO list that would greatly benefit the project. Policies typically live in the Perl::Critic::Policy:: namespace.

InputOutput::ProhibitJoinedReadline - recommend "local $/ = undef" instead

RegularExpressions::ProhibitComplexRegexps - If regexp is longer than N characters/lines, recommend it be split into "qr//" pieces

TestingAndDebugging::ProhibitProlongedStrictureOverride - Make sure that the lexical scope of a "no strict" is less than N lines

  • Done!

Variables::ProhibitTopicChangeInListFunction - avoid things like "map {s/ /+/g} @urls". Recommend for loops instead. Oh, and try to think up a better name.

  • How about ProhibitVoidMap
    • That's not the same, and it's already implemented!

ValuesAndExpressions::ProhibitComplexVersion - http://rt.cpan.org/Ticket/Display.html?id=20439

Profiling

Perl::Critic can be a resource pig. Profile it and help find the hot spots.

% perl Build.PL
% ./Build
% perl -Mbib -d:DProf t/40_criticize.t
% dprofpp

Incorporate Perl::Critic rules into your projects

This is a great way to get your feet wet and understand the power, and limitations, of Perl::Critic.

You can:

  • Install Perl::Critic
  • Run "perlcritic -top MyModule.pm"
  • Create a custom config file
  • Install Test::Perl::Critic
  • Add a t/perlcritic.t to your dist

Perl::Critic::Bangs

Andy Lester's set of extensions. One of them checks for variable names ending with digits, but $md5 should be OK.

Random

Andy Lester is having a problem where he runs P::C against Socialtext Open and it complains about "Capture variable used outside conditional", but that's apparently not true. Featured on 3D Insider.

permalink
Hackathon Chicago, Nov 10-12, 2006

This is the home page wiki for Hackathon Chicago, Nov 10-12, 2006. The static website is at http://hackathon.info

Did you write about the Hackathon?

If you wrote about the hackathon, or posted pictures, please post them on the reporting page.

Lessons learned from this Hackathon

Pete and Andy and a bunch of other people wrote up this post-hackathon recap.

Please add your advice for future Hackathon attendees to the Hackathon Attendees HOWTO.

The Perl-ish people -- who we are

  • The attendees list is as complete as it can be. Make it more complete if you can.

The Perl-ish work -- what we do; what we did!

Communications (human, email, and computer)

Hackathon logistics

  • The Todo list tracks organizational tasks. Add your name if you can help out.

Transportation

  • The Arrival Schedule will help coordinate transportation. Make a note if you'll need a ride to the hotel from either the Holiday Inn (van Galder bus drop-off point) or the Pingree Road (not the Crystal Lake) Metra station. The hotel will pick you up on Friday; Pete and Andy will do so other times. Please make it easy for them to schedule their time by signing up; they can't read minds.
  • Use the Departure Schedule if you'd like to coordinate your leaving.

Lodging, Food, and Meeting space

  • Country Inn & Suites is the place we're doing this. There's a special rate.
  • Pete and Andy are going to get lots of snacks 'n' food 'n' stuff for hacking. Make specific requests, we'll do what we can.
  • There is food nearby for meals.

Here's a list of Hackathon projects. Please note that the Hackathon is NOT just about Perl 6 and Parrot. Anyone who has a Perl project they'd like to work on is welcome.

Feel free to add your own, and if you have an svn repository that you would like mirrored on-site, please mention it at SVK Mirrors

List of all projects:



Thursday

Pete/Andy set up stuff, and bring people in.

Friday

8am -- Pete arrives / setup and organization
6pm -- Dinner/food in the meeting room

Saturday

6pm -- Dinner/food in the meeting room
6pm -- Krugle presentation in the meeting room

Sunday

8am-1pm -- Meeting room unavailable
6pm -- Dinner/food in the meeting room



  Who Fri Sat Sun From Where Online
A David Adler (dha) New York dha on irc.perl.org
B Jess Balint X? X X? Chicago jessb5760jessb5760
C chromatic   ! Portland, OR  
  Jason Carter   !   Crystal Lake, IL  
  Jason Crome   DeKalb, IL TheOneCromeDomeTheOneCromeDome
D Richard Dice ! Toronto, ON  
  Matt Diephouse X Ann Arbor, MI  
  Chris Dolan     Madison, WI  
  Clyde Forrester   X   Forest Park, IL  
F Mike Fragassi   X   Chicago  
G Jerry Gay Seattle, WA mikethepodmikethepod
  Patty Giorgas X     Chicago  
  Ryan Gerry   X McHenry, IL  
  Jason Gessner       Milwaukee, WI  
H Todd Hepler X X St. Louis, MO  
I Kelli Ireland   Pittsburgh, PA kelli3125kelli3125
J Andrew Johnson ?   Downers Grove, IL  
  Kirsten Jones Scotts Valley, CA synedra@mac.comsynedra@mac.com
K Jim Keenan Brooklyn, NY irc.perl.org: kid51
  Pete Krawczyk Wonder Lake, IL pkrawczypkrawczy
  Ken Krugler     Silicon Valley, CA  
L Andy Lester McHenry, IL petdancepetdance
  Doug Lim X X Schaumburg, IL dlim60194dlim60194 doug_lim.rmdoug_lim.rm
M Josh McAdams   X Chicago, IL  
  John Melesky ! X   Chicago, IL phaedrusdeinusphaedrusdeinus
  Adnan Menon X     Chicago  
O Bill Odom St. Louis, MO  
P Steve Peters   X? X Madison, WI fisharerojofisharerojo
  Pete Prodoehl     Milwaukee, WI pjrasterpjraster
  Jonathan Rockway X Chicago, IL irc.perl.org: jrockway
  Andrew Rodland     Chicago irc: hobbs
S Chip Salzenberg Jupiter irc.perl.org: chip GroutNASAGroutNASA
  Michael Schwern Portland, OR MichaelSchwernMichaelSchwern irc.perl.org:Schwern
  Rick Scott Sault Ste Marie, ON irc.perl.org:shadowspar
  Elliot Shank Chicago, IL elliotshankelliotshank
  Mark W. "catfood" Schumann   X X Cleveland, OH  
  Vishal Soni X X X Minneapolis, MN  
  Michael Stemle X Chicago, IL irc.perl.org:manchicken mannhuhnmannhuhn
  Ken Swanson X   St. Louis, MO  
T Al Tobey       Grand Rapids, MI Tobert42Tobert42
W Michael R. Wolf Seattle, WA  
  Jonathan Worthington Scarborough, England irc.perl.org: jonathan

marks people who have arrived.

(Please keep this in alphabetical order)



Thinking of bringing a spouse or kids? Get some idea about what's around from the Hacker Widows and Hacker Orphans pages.

permalink
Easy Jet Customer Contact Helpline Number

Call the telephone number above if you need assistance managing your flight booking online, or have any concern to raise with EasyJet customer service over the phone.EasyJet aircraft

EasyJet is one of Europe’s leading low-cost airlines, with business ranging across thirty separate countries.

Having been founded 20 years ago to deal with a perceived gap in the market for low-cost air travel, EasyJet’s first routes were short ones within the UK. The ultra-low cost philosophy caught on however: the firm was listed on the stock exchange, attracting much investor interest. Presently the airline employs over 8,000 people and possesses a fleet of more than 200 aircraft.

Emblematic of the shift in short haul air travel to an ultra-budget philosophy, EasyJet has built on its successes by expanding into package holidays for most of its travel destinations.

Easy Jet Customer Contact Helpline Number

permalink
EDF Energy Customer Services

Edf Energy company supplying energy and telephone services to homes and businesses in the UK. If you are already Edf Energy Customer , we are very interested to hear about your views on their phone menu system. If you have decided that you want to change your current energy supplier, you can call the Edf Energy-customer-services helpline on 0844 381 5192,and discuss with a member of EDF’s EnergyTeam what are the benefits of becoming their customer.

permalink
ATestForEveryBug

Leader: Steve Peters
Interested: Michael Schwern
Interested: Jim Keenan
Curious: Michael R. Wolf

A problem over the years in Perl 5 has been that bugs mysteriously get fixed. This is a big problem for two reasons. First, we don't know when a bug is fixed and we are able to close the bug from the RT queue. Second, we don't know if the bug is fixed and then broken again.

I'll be working on getting tests TODO tests created for as many of the existing bugs in the Perl 5 bug queue as possible over the weekend. This is fortunately an easy place for nearly anyone to contribute.

Resources

  • [perlhack] - please skim before getting started, especially on how to get Perl 5 sources via rsync.

Infrastructure

  • need to set up some sort of SVN prior to the arrival

This has something todo with the Lifecycle module:

my $lifecycle = RT::Lifecycle->Load('default');
my @statuses = $lifecycle->Valid;

probably gets you what you want. Most of the perl classes that the BestPractical guys expect us to use in scripts have reasonable pod documentation,

Although often you have to remember to also consult the superclass documentation as well, since sometimes the documentation is at that level, in things like RT::Record and RT::SearchBuilder.
You really don't want to go about it that way.
You want to ask the Queue for the valid statuses, which is why I
pointed to the perldoc for Queue.pm.

A Queue object can get you both global and queue specific sets of
statuses, and it can also tell you if a Status is valid for a given
Queue.

Vaillant Contact Helpline Number

Contact Helpline Number Service UK

contributed by c hlplne on Jul 6 7:41am

permalink
First Post in W Blog Weblog

This is the first post in W Blog Weblog. Click New Post to add another post.


Monitoring VMware NSX SpoofGuard with REST API and Perl
12

In some prior blogs, we demonstrated leveraging NSX REST API with Python. See prior blogs, Automating Security Group and Policy Creation with NSX REST API and Automating VMware NSX Security Rules Creation using Splunk and Some Code. In this blog, we demonstrate how NSX REST API can be used with the popular Perl programming language.

One of Perl’s key strengths is the vast amount of Perl modules/libraries available via the Comprehensive Perl Archive Network (CPAN). There is also a CPAN module included with Perl which is used to automatically download and install additional Perl modules from the CPAN repository. The example Perl code in this post demonstrates a simple program that uses a Perl REST client module/library with NSX REST API to retrieve NSX SpoofGuard information.

[]UK Contact Number Blizzard

Other contact Numbers

Customer Service Contact Numbers UK

contributed by c hlplne on Jun 19 11:24pm

permalink
Hackathon-Attendees-HOWTO

Hackathon-Attendees' HOWTO


This document is an attempt to gather suggestions and recommendations so that people coming to their first Hackathon can more easily hit the ground running and have a better Hackathon experience in general.

A fair number of the Chicago Hackathon participants were attending their first such event. While hopefully everyone enjoyed themselves and felt like their time at the Hackathon was worthwhile, the impression I got was that a lot of folks could have had an easier time 'getting started', as it were.

Whether you're a hardened Hackathoner or someone who just attended your first Perl Foundation event, you surely have some tidbits of advice to share. Please contribute freely and edit ruthlessly.


Pre-Hackathon preparation

  • Pick a project: Have a look at the projects list and pick one that you might be interested in working on. (Better yet, pick two or three). If time permits before the Hackathon, check out the source code, build it, and muck around with it a little bit. Having a basic feel for how the project works will let you work on more interesting things once you're actually at the Hackathon.
    • If you don't have time, or have trouble building from the sources, don't worry about it -- there will be plenty of folks at the Hackathon who'll be more than happy to help you get up and running.
  • If you'll be travelling any appreciable distance to the Hackathon, consider trying to find out who else is going from your area. You may be able to find a travelling companion to speak Perl to on your trip instead of having to listen to the guy in the next airline seat drone on about his colon surgery.

Stuff to bring

  • Laptop: Obviously, you'll want a computer to work on, and a laptop is most convenient for this sort of thing -- not only because it's easy to bring to the Hackathon, but because it lets you easily move around and join the impromptu sessions that tend to spring up around the pool or in the hotel lobby. A desktop could probably be made to work, though, so long as you're willing to lug it back and forth from your room each day, and as long as it has...
  • WiFi: most hotels these days provide internet connectivity only in wireless form. While there'll certainly be someone around who's nice enough to share an ethernet port, if you can manage to get a hold of a WiFi adapter your networking will be much more convenient.
  • Miscellaneous things: Think it might be useful? Bring it along! At Chicago, we had more than enough networking and power cables, but more never hurts. Other things that turned out to be useful were networking gear and spare laptop power adapters. Things we missed included a projector and a proper bottle opener.
  • Your comfy coding clothes: If you'd rather lounge around in slippers and pyjama pants than shoes and khakis, by all means bring them. I left my favourite fuzzy blue socks at home, then felt a bit foolish when the guy across the room was coding in pink monkey banana pyjamas.

Arrival

  • Geeky shirt: If you own a Perl-themed shirt or something else that makes it obvious you're a Hackathon attendee, consider wearing it to the Hackathon, especially if you'll be showing up at the Hackathon early and if you've never met the organizers face-to-face. It'll be easier for your fellow Perl hackers to pick you out.

At the Hackathon

  • Don't be afraid to ask questions. Nobody will look down upon you for calling out "Hey, can somebody help me compile X?" (In fact, some of the most interesting things that went on at Chicago sprung from trying to help people build Parrot.)

After the Hackathon

  • Contribute your newfound insights to this Hackathon Attendees HOWTO, so that the next generation of first-time attendees can benefit from them. =)
permalink
First Post in Online Calculator Weblog

Calculator is an imperative tool for a businessman, financier, married man and even a school-age child. Quickly, clearly and firmly on-line calculator permits you to perform all the quality mathematical operations like division, subtraction, addition or multiplication, further as operations with decimal fractions. To use the online calculator, that isn't necessary to transfer, you merely enter the specified variety by suggests that of graphical buttons, and counting on the specified operation, click on the image ‘division’, ‘subtraction’, ‘multiplication’ or ‘addition’. Using free online calculators you mostly can decipher your budgets properly and, therefore, it will assist you to save lots of cash and to grow financially. At constant time online scientific calc can assist you to resolve issues associated with physics, chemistry, algebra, geometry, and different engineering sciences.

permalink
First Post in Modern Perl Programming Weblog

This Perl programming tutorial is a great scripting guide to help you fully understand Perl script. Find Perl tutorials and programming examples to master your knowledge of Perl Scripting.

Perl programming tutorial

1. Using The Perl interpreter

1.1. Find Perl Interpreter

which perl 

http://linuxconfig.org/images/find-perl-interpreter.gif

1.2. Implicit Execution

NOTE:*Every script starts with *shebang:"#!" which is not read as a comment. First line is also a place where you put your interpreter which in this case is perl.

#!/usr/bin/perl print "Perl Programming\n"; 

Make Perl Script Executable:

chmod +x perl_script.pl 

http://linuxconfig.org/images/perl-implicit_execution.gif

1.3. Explicit Execution

print "Perl Programming\n"; 

Make Perl Script Executable:

chmod +x perl_script.pl 

http://linuxconfig.org/images/perl-explicit_execution.gif

2. Simple Perl script

#!/usr/bin/perl # print "Perl Programming Tutorial\n"; 

http://linuxconfig.org/images/simple-perl-script-example.gif

3. Current path to Perl modules

List all available current paths to perl modules:

perl -e 'print "@INC" . "\n";' 

http://linuxconfig.org/images/perl-modules-path.gif

4. Variables

$ - Scalar Variable
% - Hash Variable
@ - Array
& - Subroutines

4.1. Using Perl default variable $_

#!/usr/bin/perl
$_ = "Perl Programming default variable.\n";
print; 

http://linuxconfig.org/images/perl-default-variable.gif

4.2. Defined Function

#!/usr/bin/perl

# declare perl scalar do but not define value
$perl_scalar;
#we can use conditional operator '?:' to test perl defined funtion
$variable = defined($perl_scalar) ? "Variable \$perl_scalar is Defined!"
 : "Variable \$perl_scalar is NOT Defined!";
print $variable."\n";
# declare perl scalar with value
$perl_scalar="perl";
$variable = defined($perl_scalar) ? "Variable \$perl_scalar is Defined!" 
: "Variable \$perl_scalar is NOT Defined!";
print $variable."\n"; 

http://linuxconfig.org/images/perl-defined-function.gif

4.3. Scalar variable

#!/usr/bin/perl
#Scalars hold just single data type: string, number or perl reference
#Scalars definition in Perl
$scalar_number = -5; 
$scalar_string1 = "In PERL Scalars are always referenced with \x24 in front of each variable name. ";
$scalar_string2 = "5 items";
#Undescore can be use for big numbers 
$scalar_milion = 1_000_000;
#Print scalar values
print $scalar_number."\n";
print $scalar_string1."\n";
print $scalar_string2."\n";
print $scalar_milion."\n";
#perl scalar addition
print $scalar_number + $scalar_milion."\n"; 

http://linuxconfig.org/images/perl-scalar-variable-example.gif

4.3.1. Single-Quoted Strings

#!/usr/bin/perl
 
#Single-Quoted scalar strings
$scalar_string1='perl';
print "String 1: ".$scalar_string1."\n";
$scalar_string2='#!/usr/bin/perl';
print "String 2: ".$scalar_string2."\n";
$scalar_string3='Perl
Programming
Tutorial';
print "String 3: ".$scalar_string3."\n";
$scalar_string4='Perl\n';
print "String 4: ".$scalar_string4."\n";
$scalar_string5='\'\'\\';
print "String 5: ".$scalar_string5."\n";
$scalar_string6='';
print "String 6: ".$scalar_string6."\n";
$scalar_string7='I\'m reading Perl Programming Tutorial';
print "String 7: ".$scalar_string7."\n"; 

http://linuxconfig.org/images/single-quoted-trings-perl.gif

4.3.2. Double-Quoted Strings

#!/usr/bin/perl
#Double-Quoted scalar strings
$scalar_string1="perl";
print "String 1: ".$scalar_string1."\n";
$scalar_string2="#!/usr/bin/perl";
print "String 2: ".$scalar_string2."\n";
$scalar_string3="Perl
Programming
Tutorial";
print "String 3: ".$scalar_string3."\n";
$scalar_string4="Perl\n";
print "String 4: ".$scalar_string4."\n";
$scalar_string5="\'\'\\\"";
print "String 5: ".$scalar_string5."\n";
$scalar_string6="";
print "String 6: ".$scalar_string6."\n";
# add "!" ASCII character in octal form !=041
$scalar_string7="I\'m reading Perl Programming Tutorial \041";
print "String 7: ".$scalar_string7."\n";
# add "@" ASCII character in hexadecimal form @=40
$scalar_string8="Any feedback about this \uperl \uprogramming
 \ututorial to: web\x40\lL\LINUXCONFIG.ORG\E";
print "String 8: ".$scalar_string8."\n"; 

http://linuxconfig.org/images/double-quoted-strings-perl.gif

4.3.3. String Operators

#!/usr/bin/perl

#Scalar string Operators
$scalar_string1="pe"."rl";
print "String 1: ".$scalar_string1."\n";
$scalar_string2="Perl Programming Tutorial " x (1+1);
print "String 2: ".$scalar_string2."\n";
$scalar_string3="3"."\ttabs" x 3;
print "String 3: ".$scalar_string3."\n";
$scalar_string4="Perl\x20".'Programming '."Tutorial";
print "String 4: ".$scalar_string4."\n";
$scalar_string5=9x5;
print "String 5: ".$scalar_string5."\n"; 

http://linuxconfig.org/images/perl-string-operators.gif

4.3.4. Non-Decimal Integers

#!/usr/bin/perl
 
#perl binary integer
$hash_binary_integer = 0b10000;
#perl octal integer
$hash_octal_integer = 020;
#perl hexadecimal integer
$hash_hexadecimal_integer1 = 0x10;
$hash_hexadecimal_integer2 = 0x124c_78_aa;
 
print $hash_octal_integer."\n";
print $hash_binary_integer."\n";
print $hash_hexadecimal_integer1."\n";
print $hash_hexadecimal_integer2."\n"; 

http://linuxconfig.org/images/perl-Non-Decimal-integers.gif

4.3.5. Scalar Constant Variable

#!/usr/bin/perl
 
$ordinary_scalar = 5;
$ordinary_scalar = 10; 

print $ordinary_scalar."\n";

#perl constant declaration
*SCALAR_CONSTANT = 5;
$SCALAR_CONSTANT = 10; 

http://linuxconfig.org/images/perl-scalar-constant-variable.gif

4.3.6. String And Numeric comparison Operators

Comparison String Numeric
Equal eq ==
Not Equal ne !=
Less than lt <
Greater than gt >
Less than or equal le <=
Greater than or equal ge >=
#!/usr/bin/perl
# String comparison
if ( 'Perl' eq 'perl' ) {
print "TRUE\n";
} else {
print "FALSE\n";
}

# Numeric comparison
if ( '2.4' != '2.6' ) {
print "TRUE\n";
} else {
print "FALSE\n";
} 

http://linuxconfig.org/images/string-and-numeric-comparison-operators.gif

4.4. Lists

#!/usr/bin/perl

#Lists definition in Perl
print ("Perl ","programming ","Tutorial","\n"); 

http://linuxconfig.org/images/perl-lists.gif

4.5. Arrays

4.5.1. Create and print array

#!/usr/bin/perl
 
#CREATE AN ARRAY
@perl_array1 = qw(Perl Programming Tutorial );
@perl_array2 = ("Perl ", "Programing ", "Tutorial", "\n");
@perl_array3 = (1 .. 3);
$perl_array4[0] = "Perl ";
$perl_array4[1] = "Programming ";
$perl_array4[2] = "Tutorial";
$perl_array4[50] = "\n";

#ADD ELEMENTS TO AN ARRAY
$perl_array1[3] = "\n";

#PRINT ARRAY
print @perl_array1;
print @perl_array2;
print @perl_array3;
print $perl_array1[3];
print @perl_array4;
# What index has a last element of an array
print "Last element of perl_array4 has index: " .  $#perl_array4 ."\n"; 

http://linuxconfig.org/images/create-and-print-perl-array.gif

4.5.2. Push and Pop Arrays

#!/usr/bin/perl

# CREATE AN ARRAY
@perl_array = (1 .. 3);

# PUSH NEW ELEMENT TO THE AND OF AN ARRAY
push(@perl_array, "\n");

# PRINT ARRAY
print  @perl_array;

# POP LAST ELEMENT FROM AN ARRAY
$perl_scalar = pop(@perl_array);
print  @perl_array;

# PRINT NEW LINE
print $perl_scalar; 

http://linuxconfig.org/images/push-and-pop-arrays-in-perl.gif

4.5.3. Determine The Length of an Array

#!/usr/bin/perl
 
#CREATE AN ARRAY
@perl_array = (1 .. 3);
$number_of_elements = @perl_array;
print "\@perl_array has: " . $number_of_elements  . " elements.\n";
print "\@perl_array has: " . scalar(@perl_array)  . " elements.\n"; 

http://linuxconfig.org/images/determine-the-length-of-an-array-in-perl.gif

4.5.4. Merge and Append Arrrays

#!/usr/bin/perl
 
#CREATE AN ARRAY

@perl_array1 = (".\n", "easy", "very ") ;
@perl_array2 = ("is ", "Programming ", "Perl ");
@perl_array3 = (@perl_array1, @perl_array2);
# REVERSING ELEMENTS 
print reverse @perl_array3; 

http://linuxconfig.org/images/merge-and-append-arrrays-in-perl.gif

4.5.5. Sort Arrays

#!/usr/bin/perl
 
#CREATE AN ARRAY
 
@perl_array = (3, 4, 1, 2);
@sorted_array1 = sort @perl_array;
@sorted_array2 = sort {$b <=> $a} @perl_array;
 
print "@sorted_array1 \n";
print "@sorted_array2 \n"; 

http://linuxconfig.org/images/sort-arrays-in-perl.gif

4.5.6. Delete Element from an Array

#!/usr/bin/perl
 
#CREATE AN ARRAY
@perl_array = (1, 2, 3, 4);
# CHECK IF THE ARRAY ELEMENT EXISTS
if (exists($perl_array[2])) {
	delete $perl_array[2];
} else {
	print "Array element is mising!\n"
}
print @perl_array, "\n"; 

http://linuxconfig.org/images/delete-element-from-array-in-perl.gif

4.6. Hash

4.6.1. Create Hash

#!/usr/bin/perl
 
# CREATE HASH
%perl_hash = ( 
	browser => iceweasel,
# you can also use comma instead of arrow operator
	os , linux,
);
# PRINT HASH ELEMENT
print "$perl_hash{'browser'}\n"; 

http://linuxconfig.org/images/create-hash-in-perl.gif

4.6.2. Add Element to a Hash

#!/usr/bin/perl

# CREATE HASH
%perl_hash = ( 
	browser => iceweasel,
# you can also use comma instead of arrow operator
	os , linux,
);
# PRINT HASH ELEMENT
print "$perl_hash{'browser'}\n";

# ADD ELEMENTS TO A HASH
%perl_hash = (%perl_hash, programming, perl);

# PRINT ALL ELEMENTS
print join(" ", %perl_hash). "\n"; 

http://linuxconfig.org/images/add-element-to-hash-in-perl.gif

4.6.3. Print Hash

#!/usr/bin/perl

# CREATE HASH
%perl_hash = qw( 
	ssh 22
	http 80
	https 443
	telnet 23
	postgres 5432
);
 
while (($hash_key, $hash_value) = each %perl_hash ){
	print "$hash_key uses port $hash_value\n";
} 

  • Teach Yourself Web Publishing with HTML 3.2 in 14 Days, _ Laura Lemay_, Sams.Net Publishing.
  • The Internet Unleashed, J. Ellsworth, B. Baron, et al., Sams.Net Publishing
  • The Internet Complete Reference(2nd Ed.), H. Hahn, McGraw-Hill
  • Webmaster in a Nutshell, S. Spainhour and V. Quercia, O'Reilly and Associates Inc.
  • Every Student's Guide to the World Wide Web, K. Pitter and R. Minato, McGraw Hill
  • HTML Sourcebook, I.S. Graham, Wiley and Sons
  • Definitive Guides, tutorials & How-to's, C. Musciano and B. Kennedy, Fixithere. Inc.
permalink
Attendees
  Who Fri Sat Sun From Where Online
A David Adler (dha) New York dha on irc.perl.org
B Jess Balint X? X X? Chicago jessb5760jessb5760
C chromatic   ! Portland, OR  
  Jason Carter   !   Crystal Lake, IL  
  Jason Crome   DeKalb, IL TheOneCromeDomeTheOneCromeDome
D Richard Dice ! Toronto, ON  
  Matt Diephouse X Ann Arbor, MI  
  Chris Dolan     Madison, WI  
  Clyde Forrester   X   Forest Park, IL  
F Mike Fragassi   X   Chicago  
G Jerry Gay Seattle, WA mikethepodmikethepod
  Patty Giorgas X     Chicago  
  Ryan Gerry   X McHenry, IL  
  Jason Gessner       Milwaukee, WI  
H Todd Hepler X X St. Louis, MO  
I Kelli Ireland   Pittsburgh, PA kelli3125kelli3125
J Andrew Johnson ?   Downers Grove, IL  
  Kirsten Jones Scotts Valley, CA synedra@mac.comsynedra@mac.com
K Jim Keenan Brooklyn, NY irc.perl.org: kid51
  Pete Krawczyk Wonder Lake, IL pkrawczypkrawczy
  Ken Krugler     Silicon Valley, CA  
L Andy Lester McHenry, IL petdancepetdance
  Doug Lim X X Schaumburg, IL dlim60194dlim60194 doug_lim.rmdoug_lim.rm
M Josh McAdams   X Chicago, IL  
  John Melesky ! X   Chicago, IL phaedrusdeinusphaedrusdeinus
  Adnan Menon X     Chicago  
O Bill Odom St. Louis, MO  
P Steve Peters   X? X Madison, WI fisharerojofisharerojo
  Pete Prodoehl     Milwaukee, WI pjrasterpjraster
  Jonathan Rockway X Chicago, IL irc.perl.org: jrockway
  Andrew Rodland     Chicago irc: hobbs
S Chip Salzenberg Jupiter irc.perl.org: chip GroutNASAGroutNASA
  Michael Schwern Portland, OR MichaelSchwernMichaelSchwern irc.perl.org:Schwern
  Rick Scott Sault Ste Marie, ON irc.perl.org:shadowspar
  Elliot Shank Chicago, IL elliotshankelliotshank
  Mark W. "catfood" Schumann   X X Cleveland, OH  
  Vishal Soni X X X Minneapolis, MN  
  Michael Stemle X Chicago, IL irc.perl.org:manchicken mannhuhnmannhuhn
  Ken Swanson X   St. Louis, MO  
T Al Tobey       Grand Rapids, MI Tobert42Tobert42
W Michael R. Wolf Seattle, WA  
  Jonathan Worthington Scarborough, England irc.perl.org: jonathan

marks people who have arrived.

(Please keep this in alphabetical order)

permalink
Weblog Navigation
Loading...
Weblog Archives
  • Loading...

Upload Files

Click "Browse" to find the file you want to upload. When you click "Upload file" your file will be uploaded and added to the list of attachments for this page.

Maximum file size: 50MB

 
 
 
File Name Author Date Uploaded Size

Save Page As

Enter a meaningful and distinctive title for your page.

Page Title:

Tip: You'll be able to find this page later by using the title you choose.

Page Already Exists

There is already a page named XXX. Would you like to:

Save with a different name:

Save the page with the name "XXX"

Append your text to the bottom of the existing page named: "XXX"

Upload Files

Click "Browse" to find the file you want to upload. When you click "Add file" this file will be added to the list of attachments for this page, and uploaded when you save the page.

 
 
 
Add Tags

Enter a tag and click "Add tag". The tag will be saved when you save the page.

Tag: 

Suggestions: