Up Prev Next
From: DougJBate at aol dot com
Subject: Re: Transactions
Date: Aug 27 1999 1:33PM
In a message dated 8/27/99 9:22:25 AM Eastern Daylight Time, firstname.lastname@example.org
> > ($sql = <<"SQL") =~ s/^\s+@@@ ?//gm;
> > @@@ -- begin transaction
> > @@@ select * from master..syslogins
> > @@@ if \@\@error != 0
> > @@@ begin
> > @@@ raiserror 30000, 'OUCH'
> > @@@ end
> > @@@ -- commit
> MOTHER, MARY and JOSEPH. *w*h*a*a*a*a*a*a*t* is this, and why do you do
> it? W-OW.
> What is with the number of '@'s threatening to exceed the rest of the
> letters by a simple majority? ... I hope I don't seem too naive to bother
> with, but I'm mostly not sure of the difference between "@@@" and "@@@ --"
The clue to understanding this is in the line that
begins the "here" document. In addition to identifying
the bounds of the document (from the next line down to
the line beginning with SQL), it is automagically removing
the " @@@ " characters at the beginning of each line.
This is a rather esoteric Perl idiom that enables a coder
to format lines in a here document much to their heart's
content--but doesn't add much to the self-documenting nature
of Perl code (IMHO).