Rob Dixon wrote:
Greg wrote:
I have an input file that I have to evaluate whether to include lines
based upon their last character.
Is there a simple regex that would allow me to
assign the very last character to a variable?
^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^
In my case it will either be A or I (capital i) if that helps?
Thanks very much from a perl newb.
my $line = "1234567890A\n";
my ($lastchar) = $line =~ /(.)$/;
That assigns the second to last character.
John
--
Those people who think they know everything are a great
annoyance to those of us who do. -- Isaac Asimov
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/