[sf-lug] Tutor me in Programming?

Jeff Bragg jackofnotrades at gmail.com
Sun Sep 7 08:49:25 PDT 2008


> You can add numbers, but you can only "concatenate" (append one string to
> another) strings.  There's also a whole art and science to manipulating
> strings.
>

Perl is somewhat of an exception to this rule.  While it won't exactly let
you *add* strings/characters as you would integers, it will allow you to
increment them.  For example, if you had a variable $v and incremented it as
$v++, it would yield the next successive alphabetic element, so $v = 'a'
would become 'b' , $v = 'n'  would become 'o', $v = 'z' would become 'aa',
and so forth, treating the string as much as possible like an integer
(including incrementing the values starting from the left, which would be
the least significant digit in a integer).  So, $v = 'abc', if incremented,
becomes 'abd', and so forth until when it reaches 'abz', incrementing again
would yield 'aca'.

I'll stop corrupting people with Perl black magicks now.  You've given a
succinct, easy-to-digest, abstract overview of the essentials of
programming, IMO.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://linuxmafia.com/pipermail/sf-lug/attachments/20080907/a51c2331/attachment.html>


More information about the sf-lug mailing list