Perl: the time: localtime
Tutoring computer science, you need to discuss the built-in functions of the language(s) you use. The tutor opens a discussion about Perl’s handling of time.
Perl, apparently a language meant to process data in large organizations, has a few built-in ways to present the time.
One of Perl’s time functions is localtime. On my systems, these few lines
#!/usr/bin/perl
$tim=localtime;
print “The time is $tim”;
give output like
The time is Sun Jan 11 15:43:32 2015
The above code works for me on both Windows and Linux. However, it uses only one aspect of Perl’s time handling.
Speaking of time: today, I won’t take much of yours:) I will be discussing more about Perl’s built-in time features in future posts.
Source:
McGrath, Mike. Perl in easy steps. Southam: Computer Step, 2004.
Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.
Leave a Reply
You must be logged in to post a comment.