|
Quiz Page perl The perl quiz has changed! We have replaced perl questions with answers! And from those answers you'll find further links to even more information - forums where you can ask questions, training courses, longer articles, and more. [link to quiz index] ...
If you really want the old quiz
questions, you can find them
here,
here,
here and
here ... and
with onward links to the possible answers to each question too.
Perl - calls to methods that use => - what do they mean?Have you seen Perl method calls that look like this?
$present = new box(-smell => "chocolate", noise => "silent");
and wondered "what is all this => stuff" and "what's the - sign for"?
...
How to do multidimensional arrays (or rather lists and hashes) in PerlIn Perl, you can have a list of lists, a hash of hashes, a hash of lists or a list of hashes - in effect, two dimensional arrays but with much more flexibility.And where you can have two dimensional ...
Perl functions such as chop change their input parametersTypically, functions / named blocks of code take a series of operands / parameters as inputs, and return a result which is saved into another variable - here's an example in Perl:
$size = ...
Using Perl to generate multiple reports from a HUGE file, efficientlyIf you want to extract two distinct reports from a large data source, there are a number of ways you could do it. The first two are not brilliant:
1. You could read the entire file into memory, and ...
The difference between dot (a.k.a. full stop, period) and comma in PerlIf (Perl) I write
$x = "12";
$y = "25";
print $x,$y;
print $x.$y;
print "\n";
Then I'll get output
12251225
In other words - ...
Finding all matches to a pattern in Perl regular expressionsA regular expression usually matches the leftmost occurrence of a pattern within an incoming (source) string.
This doesn't matter if all you're looking to do is find whether or not your source ...
What order are operations performed in, in a Perl expression?Mathemetical operators in Perl aren't simply performed left to right - very early on your Learning to Program in Perl course you'll learn that multiplications and divisions happen before additions and ...
December courses - PHP, Python, Perl - and a weekend Lua courseLua is a powerful, fast, lightweight, embeddable scripting language. It's good and has a very open license so you can use it widely - even within your commercial products - at no cost. That's made ...
Perl - retrieving and caching web resourcesIs there some useful data on the web which you would like to use in your Perl script? If there is, go ahead and download it, grab the page, store it as a file and use it ... subject of course to ...
Why would you want to use a Perl hash?"What would I use one of THOSE for?" - a question often asked by newcomers to Perl when I first introduce hashes. Well - in writing a script to count up how many articles I've written about each ...
Awk v Perl"The AWK utility is a data extraction and reporting tool" - Wikipedia
"Perl was developed as a language to make report processing easier" - Wikipedia
So what's the difference?
Looking through all ...
Perl and CGI - simple form, and monitoring script.In some ways, Perl and CGI (Common Gateway Interface) is "old hat", but some times it's still just what you need.
Over the last couple of days, I've been working with Perl, with a customer for an ...
Take the dog on a lead - do not carry her. Perl references.Taking the dog out for a walk? It's much easier to use a lead than to carry the whole dog.
And ... in a similar vein ... when you're passing some data into a named block of code (a.k.a. sub, ...
Sigils - the characters on the start of variable names in Perl, Ruby and FortranA sigil (from Latin sigillum "seal") is a symbol created for a specific magical purpose. A sigil is usually made up of a complex combination of several specific symbols or geometric figures, each with ...
Searching through all the files in or below a directory - Ruby, Tcl, PerlMany of our customers want to learn how to traverse all the files in a directory, or perhaps even all the files in or below a directory. I quite often write a demonstration program during our courses ...
Handling binary data in Perl is easy!Perl can handle binary data just as easily as ASCII text - but YOU - if you're the programmer - must understand the format of the data that you'll be working with. With binary data it's every bit as ...
Single and double quotes strings in Perl - what is the difference?In Perl, there's usually more than one way of doing it ...
If you're writing a string of text into your program, your first possibility is to use single quotes - in which case you're writing a ...
When variables behave differently - Tie in PerlDeep in the bowels of any programming language is code to store information into a variable, and get information back from that variable. And in a language that's dynamic in its memory allocation, ...
Perl - a quick reminder and revision. Test yourself!At the start of the second day of my second Perl course this week (yes, really!!) I put up a quick revision of what I had covered on the first day for my not - really - new - to - Perl group. How ...
Not multidimentional arrays - but lists of lists. Much more flexible. Perl!In Perl, you don't have multidimensional structures as such - you have list and hashes ... and you can have lists of hashes, hashes of lists and hashed of hases too. Which give you almost all of the ...
$ is atomic and % and @ are molecular - Perl"When do I use a $, when do I use an @, and when do I use a % ?" That is a frequently asked question on a Perl course, where a delegate had dabbled with a bit of Perl ahead of time.
You use @ if ...
From fish, loaves and apples to money, plastic cards and BACS (Perl references explained)Money's useful stuff.
Before money, transactions were undertake on a barter system; if I wanted a loaf of bread I might exchange it for a fish. If I was wanting to book passage on tthe stagecoach ...
Perl - making best use of the flexibility, but also using good coding standardsSometimes, examples written during a course are throw-aways ... but at other times they become a useful addition to our resources. On a private private Perl course that I was running yesterday, and ...
What do I mean when I add things in Perl?Some things have a natural concept of addition. And of multiplication.
You can add numbers - 5 + 7 gives 12. You can add strings of text - "Hello " + "World" = "Hello World". You can add day ...
How to interact with a Perl program while it is processing dataIf you have a long running program, how do you monitor its progress?
You could use tail -f on an output file ... but there are other options too.
a) You can output a progress line; there's an ...
Speeding up your Perl codeOn Friday morning - our Perl for Larger Project course - I was looking at coding efficiency / run speed with delegates. As an example, we took a data file from our web server logs - some 23 Mbytes of ...
DNA to Amino Acid - a sample Perl scriptA really rewarding course this week - Perl programming, for a dozen bright delegates in the bioinformatics field - the people who have defined the human code as billions of C A T and Gs and are then ...
Perl from basicsIt's refreshing to teach Perl to a class of bright but brand new programmers, which I'm doing in Edinburgh this week. For a class on novices really make me think "why" at some of the aspects us old ...
Finding your big files in Perl - design considerations beyond the course environmentIt took me about 20 lines of code - just over 300 bytes - to come up with a Perl program which looks in the current directory and everywhere below for all files over a certain size. Have a look at ...
How much has Perl (and other languages) changed?How much has Perl code mover forward over the years? A lot, and not a lot. To some extend, programming languages are the eye of the storm of technology - and that's because people who invest in ...
Reading the nth line from a file (Perl and Tcl examples)"How do I find the 100th line in a file" - a common question for newcomers to coding. The short answer is to open the file, and loop through to read lines until the one that you want. Although ...
Do I need to initialise variables - programming in C, C++, Perl, PHP, Python, Ruby or Java.Starting with a clean slate. Are variables initisialised, and if so, how? Even with this fundamental question, languages vary considerably.
C and C++
From my (e)mailbag ...
"""In a piece of code ...
How a for loop works Java, Perl and other languagesJava, Perl, PHP, Ruby, C, C++, Tcl and many other languages support a "for" loop construct.
When your program enters the top of the loop, it performs the first statement in the brackets ... in this ...
Rekeying a table - comparison in #Ruby #Perl and #PythonAlbert knows Perl and Python, Barbara knows Lua and Ruby, Colin knows Perl, and Debbie is a dab hand at PHP. Eddie does Python, Perl and PHP and Fiona cooks a great dinner for Shrek. Gordon programs ...
Perl, Python, PHP, Lua, Linux, and more - and business hotel too. Menu for 2011Whar are our plans for 2011? "Steady as she goes", I think - a gentle year of building on all we've achieved in the past year, and all that has developed in the last six months. Our hotel at Well ...
Perl - database access - DBD, DBI and DBIx modulesPerl's DBI module provides an excellent link from SQL databases to Perl, and the assorted DBD modules that fit underneath it allow it to operate well for a whole lot of different databases. But they ...
Learning Object Orientation in Perl through bananas and perhaps MoosePerl has the most incredbible range of OO facilities (though at times it's overfeatured and a bit old fashioned / tricky to use). So yesterday I wrote a whole series of examples ... and then went on ...
Making Perl class definitions more conventional and shorterPerl 5's object oriented capabilities are excellent - but often a little longwinded, and quite easy to get wrong. Moose sells itself as "postmodern object system for Perl 5 that takes the tedium out ...
Perl 6 - significantly nearer, and Rakudo looks very goodThere's been a longstanding jest that says "You'll have Perl 6 for Christmas" but goes on to add "but of course we won't tell you which Christmas."
Christmas may have arrived early this year ... for ...
Comments in and on Perl - a case for extreme OO programming"The only thing that will interpret Perl is a Perl interpreter" ... how those words rang in my ears this morning as I was writing some code to highlight source code comments in a different colour in ...
|
|