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.
Changing a variable behaviour in Perl - tieingWhat can you do with a scalar variable? When you reduce it to lowest level programming principles, not a lot ... you can create it, destroy it, save a value into it, and read a value back from it. ...
So what is this thing called Perl that I keep harping on about?"An overview of the Perl Language"
It almost sound like one of those dreaded school essays that I had to write in my several attempts to get an English "O" level (they were the things that came ...
Perl references - $$var and \$var notationsIn Perl, if I write:
$stuff = "Porridge";
then I'm setting up a variable to contain the value "Porridge".
If I write:
$stuffat = \$stuff;
then I'm setting up a variable to contain the ADDRESS OF the ...
Handling nasty characters - Perl, PHP, Python, Tcl, LuaAre your writing or maintaining a web based application that uses forms? If so, you have better be aware of some of the nasty characters that are around!
The < character, when echoed back from a ...
Sending awkward characters by email in PerlCarrying on from the email work I described in a recent article, I wrote an example today in Perl where I used the mailx program to send an email, piping to it in a system call via an echo.
For a ...
Loading external code into Perl from a nonstandard directoryHere's a piece of Perl code that loads in an external module.
push(@INC, "/var/opt/OV/bin/OpC/monitor");
eval { require "monitor_utils.pm"; };
if ($@) {
print STDERR "could not load ...
Transforming data in Perl using lists of lists and hashes of hashesIn Perl, you don't have conventional two dimensional arrays - you have lists which are single dimensional only. However, you can have a list that contains a reference to another list, in effect a ...
Do not re-invent the wheel - use a Perl module"If you think 'surely someone has done this before', you're probably right ... and in Perl, you'll find the resource you need available as a module on your system, or if it's not quite to common, on ...
Revision / Summary of lists - PerlWe've started the third day of this week's Perl course with a revision of some features of lists ... posting here as there are some useful reminders (and I came back later to add more comments!)
# ...
Configuring httpd, or Tomcat, to run CGI scripts in PerlHere's a Perl / CGI script - a "Common Gateway Interface" program that I want to run on my web server, and access via my browser. What server to I need to run it on, and how do I set that server up?
...
Keyboard reading in Perl - character by character not line by lineIf I'm typing in my age in response to a prompt and I start with a "6" character, will you assume that I'm between 60 and 69 years old? You might ... but then I may backspace (having accidentally ...
Nothing beats Perl to solve a data manipulation requirement quicklyOK - I admit it. It might be slightly out of fashion but I still love Perl for that quick hack script which is a one-off data manipulation need.
I have two files - the first containing records of ...
Weekday or Weekend PHP, Python and Perl classes?Should we run training courses during the week, or at weekends?
Our 'traditional' business has been 80% + employees of companies, government organisations and educational establishments who have ...
Converting to Perl - the sort of programs you will writeI've put many of the examples that I wrote during last week's Perl Course into our converting to Perl resource, and they've available for use and download from there, subject to the usual "use at your ...
Efficient calls to subs in Perl - avoid duplication, gain speedWhen you call a sub in Perl (a subroutine - a named block of code), you pass in a list of parameters in the list called @_. It's easy and straightforward ... but as the length of your list ...
Perl - lists do so much more than arraysopen (FH,"ac_20090225");
@stuff = <FH>;
@interesting = grep(/horse/i,@stuff);
print @interesting;
In Perl, an @ in front of a variable makes it into a list - and a list variable has the advantages ...
Small Web Server in PerlI would not encourage you to write your own web server in Perl, but I might suggest that you used the http protocol as a convenient intersystem communication protocol ... and that might result in you ...
Discount Training Courses - PHP, Perl, PythonHere's an email I wrote in answer to a request for a discount earlier today.
Many training companies quote high(er) prices, with the full anticipation that they can offer a wide range of discounts to ...
Best source to learn Java (or Perl or PHP or Python)An impossible question - there is no best way - yet it's one that I'm asked from time to time. [["Hello. I'm doing a b.tech. My friends like ur site very much. Plz help us in Java programming - plz ...
Whisky - Setting and reading cookies from PerlFancy a Whisky - if you click on this link, our barman will choose a glass of whisky at random for you, and give it you on the house. Once you're hooked and secured as a customer, he'll sell you ...
Perl substitute - the e modifierHere's a graphic illustration of the use of the "e" for "execute" modifier used on the end of substitute operation in Perl.
The "s" for substitute allows you to replace a matched pattern with a ...
Variable Types in PerlIn Perl, you have "autovivification" where variables are created when they have a values set in them, without the need to declare them. Some authorities will tell you that they are also "autotyped" ...
Preventing ^C stopping / killing a program - PerlHere's a demonstration - in Perl - that shows you how to avoid a ^C (Control C) dropping you straight out of a program.
Have you ever accidentally hit ^C in the wrong window and terminated a ...
Progress Bar Techniques - PerlHave you ever sat there and wondered "is this program nearly done ... is it still running ... how is it getting on" and wished you had a progress bar. But then have you ever watched a jerky progress ...
Perl Socket Programming ExamplesIt's always a pleasure to run private courses - for when a questions that's a little bit away from the normal comes up, I can take time to provide a full answer and demonstration without fear of ...
Out of memory during array extend - PerlUse a hash if you want a sparse list in Perl!
If you set up a list in Perl and don't fill all the members from zero up, that's OK but all the missing elements will actually use up some memory as ...
Ruby, Perl, Linux, MySQL - some training notesWe have just come to the end of a solid 12 days of training ... and we are just getting ready for the next week, with delegates arriving this evening. There's a lot going on behind the scenes, even ...
Debugging and Data::Dumper in PerlI'll admit it - I'm not a great fan of debuggers, preferring to write well structured code, and check it out with a few test / intermediate print statements. You'll often find I code: ...
Object Oriented Perl - First StepsThere are some occasions when a new example that I write / a topic that comes up on a course results in an article that's so long that it doesn't fit into the Blog / short article format, but requires ...
About dieing and exiting in PerlIf you want to end a program in Perl, you can get out quickly enough with an exit function call. But that's probably just a part of what you'll be wanting to do - you'll be wanting to generate an ...
Reactive (dynamic) formatting in PerlIf you want to format your data neatly in columns, you can use sprintf or printf to do so if you're using a fixed width font. A format of "%20s", for example, calls for a string that's 20 characters ...
Seven new intermediate Perl examplesFrom the "learning to program in Perl" course I'm running this week, I am pleased to present seven new examples ... written during the course, in front of the delegates, to show them NOT ONLY how the ...
Well structured coding in PerlWrite a small code utility - a few lines - and you can simply start at the top and work through to the bottom. But as the code increases in length, you're going to want to take out common code and put ...
Perl and Blackberries"Of course people will use Perl - it's free". No - whilst Perl is freely distributed [under license], that's not the sole reason that people use it. Blackberries, growing in profusion on the roadside ...
String matching in Perl with Regular ExpressionsSome languages used adaptive or overridden operator to perform a task depending on the operands - for example in Java, the "+" operator adds numbers, but concatenates strings, and in PHP the == ...
Formatting with a leading + / Lua and PerlIn formatted printing, you can often use a leading "+" in the format string to force a positive sign to be added in front of positive numbers - for example "%+4d" means an integer, to base 10, 4 ...
Processing all files in a directory - PerlFrom this week's Perl course:
opendir(DH, ".");
while ($igot = readdir(DH)) {
next if ($igot =~ /^\.{1,2}$/);
print "igot $igot\n";
}
You'll notice that I have used a regular ...
Dont bother to write a Perl programI can - very easily - write a Perl program to process every line of an incoming data file - indeed, that's much of where Perl originated as the "Practical Extraction and Reporting Language"
Here's a ...
Perl - map to process every member of a list (array)Perl's map function (like array_walk in PHP) allows you to do something to every member of a list - thus it often saves you the need to write a loop into your Perl, saves the Perl runtime going back ...
Perl - Subs, Chop v Chomp, => v ,During courses, I end up writing a lot of short demonstrations to show particular features of a language - this week, it's a Perl Programming Course so those examples are in Perl.
Some interesting ...
|
|