Some updates on file opening and reading in Perl ...
1. The original open function was good, but technically questionable in that the second parameter includes (as a single string) both the name of the file and an indicator as to whether it's being opened for read or write. The newer (three parame ....
Let's say that you want a Perl variable to contain a result which varies depending in the type and values of data fed in. Easy enough - but you need to think about what value you want it to hold if the inputs don't match any of the acceptable values. And there are then two approaches:
1. You can se ....
Is 10 greater than 8?
As a number, yes it is ... but if you're comparing character strings and you would for a book's index, then the character "1" comes before the character "8", so in this context the 10 is earlier than (i.e. less than) 8.
Is 14.0 the same as 14?
As a numeric value, yes it is. ....
There's a lot of well established Perl code running in many places, using versions of the language that have been used for years. But the language should not stand still, and so extra features get added in at each intermediate release level ... and that then gives us the conundrum of what we should ....
In Python, you can join a list (or a tuple) of string objects into a single string object, using the join method in the string class. As the join method's in the string class, it has to be called on a string object, and that's the separator that you're putting between each of the joined elements. T ....
You can loop through a list (we're supposed to call them "lists" not "arrays" in Perl these days!) using a foreach loop running a counter, or using the second form of foreach that doesn't provide a counter. Thus [source link]:
#!/usr/bin/perl
@demo1 = (20,30,50,60,80,200);
@demo2 = (40,70,90,40, ....
An Experiment ....
Perl is a computer language.
You write a series of instructions and the computer then performs them. Unless you state otherwise, statements are performed in order. You can, though, have conditional code, loops and calls to blocks of code elsewhere just as in other languages.
....
In Germany, a house will grow in value over the years (perhaps current economic climate excluded) but an Igloo will loose all of its value in summer (it will melt!).From last week's Perl course, where I briefly covered object orientation in Perl (the course briefing only asked me to cover it briefly ....
A Course is for the delegates .... but it's really nice if the tutor gets a little out of it too. And usually I do!
I run private courses at Company's offices on a regular basis - about 30% of my teaching time is on the road. I always ask my delegates to complete course evaluation forms as they ....
With just 90 minutes to change between trains in Frankfurt on Friday, I didn't have time for more than a quick walk around the city - but that was long enough, on a lovely day, to take a series of pictures. Have a look at the slide show [here] ....