[Israel.pm] Another way to use "$."

Mikhael Goikhman migo at homemail.com
Mon Sep 6 06:00:32 PDT 2004

On 06 Sep 2004 15:31:23 +0300, Offer Kaye wrote:
> According to http://www.perldoc.com/perl5.8.0/pod/perlvar.html ,
> there's another way to call "$.":
> <blockquote>
> You can also use HANDLE->input_line_number(EXPR) to access the line
> counter for a given filehandle without having to worry about which
> handle you last accessed.
> </blockquote>
> Which is just fine- but what's EXPR supposed to be?

$. is a read-write variable holding integers, so EXPR may be anything
that would be converted to int(EXPR).

Play with this program (just remember to enter some input line):

	use IO::Handle;
	print "$.\n";
	$. = 5.6;
	print STDIN->input_line_number, "\n";
	print "$.\n";


perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'

More information about the Perl mailing list