[29527] in Perl-Users-Digest
Perl-Users Digest, Issue: 771 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 19 16:09:40 2007
Date: Sun, 19 Aug 2007 13:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 19 Aug 2007 Volume: 11 Number: 771
Today's topics:
Re: A question about regex <jurgenex@hotmail.com>
Re: A question about regex <tadmc@seesig.invalid>
A/C Systems! Cartuners@gmail.com
Re: Help on compiling Perl 5.8.8 <sigzero@gmail.com>
Re: how to call sub by value in variable - SOLVED <nobull67@gmail.com>
Re: how to call sub by value in variable <nobull67@gmail.com>
Re: how to call sub by value in variable <nobull67@gmail.com>
Re: how to call sub by value in variable <nobull67@gmail.com>
Latest models of Gibson guitars mobilendd@gmail.com
MI5 Persecution: Fitted up 26/4/96 (951) MI5Victim@mi5.gov.uk
Newbie Perl question <divisortheory@gmail.com>
Re: Newbie Perl question <divisortheory@gmail.com>
Re: Newbie Perl question <bik.mido@tiscalinet.it>
Re: Newbie Perl question <bik.mido@tiscalinet.it>
Re: perl parse across multiple line in txt file <bhooshan.dixit@gmail.com>
Re: perl parse across multiple line in txt file <joe@inwap.com>
Re: Symbolic representation of logical operators <jurgenex@hotmail.com>
Re: Symbolic representation of logical operators <5502109103600001@t-online.de>
Re: Symbolic representation of logical operators <bik.mido@tiscalinet.it>
Re: Symbolic representation of logical operators (Mark Hobley)
Re: Symbolic representation of logical operators <joe@inwap.com>
Re: Symbolic representation of logical operators <5502109103600001@t-online.de>
Re: Symbolic representation of logical operators (Mark Hobley)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 19 Aug 2007 15:12:44 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: A question about regex
Message-Id: <M5Zxi.3383$563.1870@trndny08>
Madhusudhanan Chandrasekaran wrote:
> I am a perl newbie. I am reading from a file line by line and
> matching it for a partiuclar regex. If the match is found, I want
> to print the previous and the next few lines.
Nothing to do with Perl or REs but rather with basic algorithm design.
Because you are reading the file line by line and you can only detect the
desired line _after_ working on the next one already you need to keep a
history of one line, something like $previous_line which you update every
single time you read a new line.
Adding the following lines, too, is not a big deal. Just read and print them
when your condition is true.
jue
------------------------------
Date: Sun, 19 Aug 2007 17:30:00 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: A question about regex
Message-Id: <slrnfcgv8f.dc6.tadmc@tadmc30.sbcglobal.net>
Madhusudhanan Chandrasekaran <mc79@cse.buffalo.edu> wrote:
> I am a perl newbie. I am reading from a file line by line and
> matching it for a partiuclar regex. If the match is found, I want
> to print the previous and the next few lines.
>
> i.e. if the lines of the file are:
>
> This is a
> String
> But I do not
> know how to
> print it
>
>
> and if my pattern is "But I do not", I would like to print as
> "String But I do not know how to". Here it prints out the previous
> and the next line, keeping it variable is desired.
--------------------------------
#!/usr/bin/perl
use warnings;
use strict;
use Tie::File;
tie my @array, 'Tie::File', 'file' or die "could not tie 'file' $!";
my $prev = 1;
my $next = 1;
foreach my $i ( 0 .. $#array ) {
next unless $array[$i] =~ /^But I do not$/;
print "@array[ $i-$prev .. $i+$next ]\n";
}
--------------------------------
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Sun, 19 Aug 2007 17:40:04 -0000
From: Cartuners@gmail.com
Subject: A/C Systems!
Message-Id: <1187545204.437337.135260@o80g2000hse.googlegroups.com>
Everything you need to know about car air conditioners...
http://car-air-conditioning.blogspot.com/
------------------------------
Date: Sun, 19 Aug 2007 17:29:47 -0000
From: Robert Hicks <sigzero@gmail.com>
Subject: Re: Help on compiling Perl 5.8.8
Message-Id: <1187544587.893748.174530@g4g2000hsf.googlegroups.com>
On Aug 18, 10:14 am, "Sisyphus" <sisyph...@nomail.afraid.org> wrote:
> "Robert Hicks" <sigz...@gmail.com> wrote in message
>
> .
> .
>
>
>
> > I wonder why it is happening though. We built the server on Monday and
> > Perl compiled flawlessly and when we rebuilt on Thursday using the
> > same process I get the error now. Strange...
>
> I agree, it's odd. I'm no expert (especially on anything that aint windows),
> but as I understand it, libm is linked in automatically (by default) on some
> systems (eg windows), but is not linked in automatically on some other
> systems.
>
> My best guess is that, under the original build, libm was linked in by
> default. But under the new rebuild libm has to be explicitly linked in.
> Furthermore, configure has not detected this change (which would probably be
> a bug in configure), and the new makefile therefore fails in that regard.
>
> Or something like that :-)
>
> If you can verify that my original suggestion of modifying the makefile
> actually works, then I think that suggests that configure is not doing its
> job correctly, and you should submit a bug report.
>
> If neither of my original suggestions are helpful then you should probably
> ignore me altogether and wait for a more knowledgeable reply :-)
>
> (Best way to submit a bug report is to run 'perlbug'.)
>
> Cheers,
> Rob
Thanks, I will follow your advice.
Robert
------------------------------
Date: Sun, 19 Aug 2007 16:19:52 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: how to call sub by value in variable - SOLVED
Message-Id: <1187540392.298951.162650@50g2000hsm.googlegroups.com>
On Aug 19, 3:46 pm, "Petr Vileta" <sto...@practisoft.cz> wrote:
> My final solution. Maybe is possible to write it without using eval() ???
Yes, use symbolic references! There is nothing that can be achieved
with symbolic references that can't be done worse using eval(). But be
in no doubt - replacing symbolic references with eval() is (usually)
making matters worse not better.
> --------- CUT --------
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> my %dispatch;
> open IN,"< $0";
> while(<IN>)
> {
> chomp;
> if(m/^sub\s+ex_([^\s\{]+)/)
> {
> eval('$dispatch{' . $1 . '} = \&ex_' . $1);
> }}
You are loosing sight of the objective. You seem to want to use the
Perl symbol table itself as your dispatch table. You should either
stop wanting to do this or you should just go ahead and use symbolic
references. There's no point making things more complex.
------------------------------
Date: Sun, 19 Aug 2007 16:31:44 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: how to call sub by value in variable
Message-Id: <1187541104.611950.105630@r34g2000hsd.googlegroups.com>
On Aug 19, 9:36 am, "Mumia W." <paduille.4061.mumia.w
+nos...@earthlink.net> wrote:
> On 08/18/2007 07:56 PM, Petr Vileta wrote:
>
>
>
> > I have this simple script
>
> > #!/usr/bin/perl
> > use strict;
>
> > foreach my $sub (qw/test1 test2/)
> > {
> > foreach my $name (qw/Petr John/)
> > {
> > no strict 'refs';
> > &$sub($name);
> > }
> > }
>
> > sub test1
> > {
> > my $txt=shift;
> > print "Hallo $txt\n";
> > }
>
> > sub test2
> > {
> > my $txt=shift;
> > print "Bye $txt\n";
> > }
>
> > I use no strict 'refs' and it work fine, but how to write this with
> > strict refs? It is possible? I need to use it first time in my live and
> > reason is that subroutine names (in real script) are stored in MySQL.
>
> You can keep strict refs enabled if you are willing to turn the
> subroutines into methods:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> foreach my $sub (qw/test1 test2/)
> {
> foreach my $name (qw/Petr John/)
> {
> __PACKAGE__->$sub($name);
> }
> }
>
> sub test1
> {
> shift;
> my $txt=shift;
> print "Hallo $txt\n";
>
> }
>
> sub test2
> {
> shift;
> my $txt=shift;
> print "Bye $txt\n";
>
> }
>
> __END__
>
> This can still be dangerous I think, so validate your input before
> calling the methods.
Indeed it is more dangerous than explicit symbolic CODE refs because
unlike putting an explicit red flag in your code by saying "no
strict" you are using symrefs anyhow but in one of the forms that is
exempted from use strict. So you get _all_ the disadvantages of using
symrefs plus two new disadvantages
1) It may not be so obvious that you are using symrefs.
2) All your subroutines now have an unwanted class argument.
> It's better to just use a dispatch table as the others said.
Not always. A perl symbol table (aka package) _is_ a dispatch table.
While there are good reasons why it's probably a bad idea to use the
same package as both a "normal" package and a dynamic dispatch at the
same time table there's no rational reason[1] not to have a Perl
symbol table that you use only for CODE that you want accessible via
dynamic dispatch.
[1] There are lot's of reasons - but I've never heard anyone defend
them without resorting to emotional/religious arguments.
------------------------------
Date: Sun, 19 Aug 2007 16:39:26 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: how to call sub by value in variable
Message-Id: <1187541566.338881.125130@r34g2000hsd.googlegroups.com>
On Aug 19, 1:56 am, "Petr Vileta" <sto...@practisoft.cz> wrote:
> I have this simple script
>
> #!/usr/bin/perl
> use strict;
>
> foreach my $sub (qw/test1 test2/)
> {
> foreach my $name (qw/Petr John/)
> {
> no strict 'refs';
> &$sub($name);
> }
> }
>
> sub test1
> {
> my $txt=shift;
> print "Hallo $txt\n";
>
> }
>
> sub test2
> {
> my $txt=shift;
> print "Bye $txt\n";
>
> }
>
> I use no strict 'refs' and it work fine, but how to write this with strict
> refs? It is possible?
It's trivial to use CODE symrefs without switching off use strict.
(\&$sub)->($name);
But if you think that doing so would be an improvement then you've
misunderstood why we suggest using strict in the first place.
------------------------------
Date: Sun, 19 Aug 2007 17:00:40 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: how to call sub by value in variable
Message-Id: <1187542840.000381.231030@22g2000hsm.googlegroups.com>
On Aug 19, 4:14 am, xhos...@gmail.com wrote:
> "Petr Vileta" <sto...@practisoft.cz> wrote:
> > xhos...@gmail.com wrote:
> > > "Petr Vileta" <sto...@practisoft.cz> wrote:
> > >> I have this simple script
>
> > >> #!/usr/bin/perl
> > >> use strict;
>
> > > my %dispatch = ( test1 => \&test1, test2 => \&test2);
>
> > >> foreach my $sub (qw/test1 test2/)
> > >> {
> > >> foreach my $name (qw/Petr John/)
> > >> {
>
> > > $dispatch{$sub}->($name);
>
> > Hmm, very nice ;-) By your solution I must define $dispatch{...} for all
> > my subs.
>
> Just for all of the ones you want to be runnable based on data from the
> database!
Which might be more than 3.
By my rule "if you are doing it 3 times you're (probably) doing it
wrong" manually doing ...
%dispatch = ( foo => \&foo, bar => \&bar, baz => \&baz);
... would be wrong. Contrary to what some people may preach, there
_are_ things worse than using symrefs and maintaining a dispatch table
like the above with 50 entries in it is definitely one of them.
> > Of course it is correct practice but I get sub's names from
> > database. If I get sub name which not exist
>
> What do you use to know that it does not exist? What if it does exist,
> it just isn't a sub you want to be run based on data retrieved from
> the database?
> It seems to me to be very dangerous to run subroutines whose names are
> based on things generated beyond your control.
For this reason I suggest you prefix the names of the functions that
you want callable in this way with fixed string, indeed I'd usually
use a package name but it need not be a package name. That way no
matter what's in the input it won't be able to call any function other
than those you intended. It can only call a function you intended or
fail - so long as you don't define any functions with said prefix that
you don't intend to be called this way.
if (defined(&{"My::Handlers::$sub"})) {
no strict 'refs';
"My::Handlers::$sub"->($name);
} else {
warn "$sub not implemented\n";
}
You can check if the handler is defined as above but very often the
default behaviour of simply throwing an undefined subroutine exception
is actually the right thing to do anyhow.
> In other words, since what you want to do fundamentally violates the spirit
> of "use strict", the most straightforward way to do it is to turn off
> strict for that block.
Indeed
------------------------------
Date: Sun, 19 Aug 2007 17:35:05 -0000
From: mobilendd@gmail.com
Subject: Latest models of Gibson guitars
Message-Id: <1187544905.633509.191680@g4g2000hsf.googlegroups.com>
Reviews of latest models of best guitars, fender, gibson, yamaha, and
many more, with pictures and prices.
http://pro-guitars.blogspot.com/
And if you want to win a free guitar go here
http://freeguitars.blogspot.com/
------------------------------
Date: 19 Aug 2007 16:52:26 GMT
From: MI5Victim@mi5.gov.uk
Subject: MI5 Persecution: Fitted up 26/4/96 (951)
Message-Id: <m07071916521961@4ax.com>
Subject: Re: MI5? Please can someone explain what's going on here?
Newsgroups: uk.misc
References: <4l1khm$4cn@utopia.hacktic.nl> <4l2lhj$6h6@bignews.shef.ac.uk>
Organization: Toronto Free-Net
Distribution:
David Stretch (dds@leicester.ac.uk) wrote:
: In article <19960418.000817.55@hotch.hotch.demon.co.uk>,
: Iain L M Hotchkies <iain@hotch.demon.co.uk> wrote:
: >The (remote) possibility remains that 'Mike Corley' is either
: >not schizophrenic (but is 'pretending' to be so) or 'he' is
: >a product of a number of persons (?psychology students).
: Given other ways in which I have seen people exploit some of The Internet's
: capabilities to disrupt or indulge in sophistry, or to exploit a medium
: that resembles speech without the non-verbal and intonation cues, etc
: as a means of denigrating others, I question your use, albeit in quotes,
: of the word "remote". I'm not saying it isn't remote and therefore it is
: great, I'm just saying that I don't think we can easily classify it as
: remote, moderate, or great.
I think you can build up quite a good picture based on what someone says
and on their posting patterns. I don't think "The Internet" (capitals, no
less) is as opaque a medium as you make it out to be.
: It is not easy to determine the validity of all information on The
: Internet without making use of extra supplementary information.
: We do have the problem, pointed out by someone else, of the possibly
: "too perfect" textbook characteristics of what is being posted.
I explained that one, but I don't mind explaining it again (you don't
mind having it explained again to you, do you now?). The reason my
"symptoms" are such a perfect fit to the textbook is because the people
causing the campaign "fitted me up" in such a way that what they did
would resemble the symptoms of schizophrenia. Hence TV, radio, other
media, people in the streets etc. By a fortunate coincidence (for them)
these mthods of harassment are the ones which offer easiest channels of
access (for them).
It's really quite neat. All it takes is for people to start believing
that the "symptoms" aren't symptoms but reality, though, and the house of
cards collapses in a heap. And there are _lots_ of people now who knoiw
full well what has gone on.
: If harrassment by email, etc, has happened by someone out of the country,
: can a complaint be made that results in arrest or whatever upon that
: person's entry into the country? An interesting point which Mike may be
: able to inform us about, as he's said he will be in the UK in a few weeks
: time.
Picture the scene at the airport;
"I arrest you for being Mike Corley and mailbombing people"
"But my name isn't Corley. Who he? Mailbombing isn't illegal is it? You'd
have to lock up a lot of people if sending annoying email was a crime"
"Er....."
: --
: David Stretch: Greenwood Institute of Child Health, Univ. of Leicester, UK.
: dds@leicester.ac.uk Phone:+44 (0)116-254-6100 Fax:+44 (0)116-254-4127
========================================================================
: context-free parts of articles, conversations and things-on-the-TV and
: assume they are meant for you. Mike, this is called paranoia.
But that's the way real abuse works, too. People interject words and
phrases into what they say which they know will have meaning for the listener.
And sometimes, they make it obvious. The very first evening of my job in
Oxford, we went for a drink with the technical director, and a couple
of other employees. The TD said in an "as-if" aside to one of the others,
"Is this the bloke who's been on TV?" (he said it directly in front of
me, and obviously meant mke to hear him saying it). The other person
replied, "Yes, I think so".
I think the subtext of what the TD said was "Why are they bothering with
him? He's so insignificant, why would they possibly want to spend the
resources going after him and putting all that expensive technology in
his home, when there must be much better targets?". The Technical
Director was given to sometimes disrespecting people, you see, and in my
case he couldn't see the point of anyone expending money on harassing me.
====================================================================
Subject: Re: Treatment of Schizophrenia
Newsgroups: uk.misc,uk.legal,uk.politics,alt.politics.british
Followup-To: uk.misc,uk.legal,uk.politics,alt.politics.british
References: <153321Z22041996@anon.penet.fi> <4lge6r$p00@news.ox.ac.uk>
Organization: Toronto Free-Net
Distribution:
Illtud Daniel (idaniel@jesus.ox.ac.uk) wrote:
: Probably 'cos you come across as reasoned & articulate, it's a pity
: about the other stuff :)
Veracity is so unreasonable.
: >>pps. You should still see a doc again Mike.
: >
: >Doing so. Trouble is, all this mental-illness stuff provides camouflage
: >for the harassment, which is real. It alows people who otherwise would
: >consider the harassment seriously to disregard it. It makes conversations
: >with a lawyer or police brief when otherwise it would merit discussion.
: The point is that there are two possibilities happening here-
: 1. There's a large conspiracy of people out to get you, for no
: other reason than that they have the means to do so, and that
: it involves a lot of the Media & a proportion of the public
: 2. You (who admit to having some headspace problems) are suffering
: from acute paranoid schizophrenia.
: Possibility #1 is _possible_, but would be unprecendented (OTOH,
: how would we know?), unfeasible, and many other things beginning
: with _un_ which I can't think of at the moment. Besides, if there
: was something going on, chances are some of us here would know
: about it, and I'm convinced that nobody does.
"Unprecedented" hits the nail on the head. It _is_ unprecedented, but we
have only just reached the technical stage at which it is feasible, and
we know video-spying is done to other people (NB the Diana-Hewitt
episode) and is a routine tool of security agencies.
Perhaps what is unprecedented is not the technical side, but the social
manipulation of many people by a concealed element in what other
countries would be called the secret police. The most disturbing element
is the degree to which people allow themselves to be unquestioningly
manipulated by an evil element within the state.
951
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
------------------------------
Date: Sun, 19 Aug 2007 19:04:11 -0000
From: Zachary Turner <divisortheory@gmail.com>
Subject: Newbie Perl question
Message-Id: <1187550251.984577.255710@i38g2000prf.googlegroups.com>
Hello,
I'm just learning Perl and I'm going through a book and there was an
exercise in one of the chapters to write a simple subroutine to add up
all the values that were passed as arguments. Simple enough, I
implemented this as follows:
sub total {
my $sum;
foreach (@_) {
$sum += $_;
}
return $sum;
}
However, in the same chapter it says that if you do not put a return
statement, the return value of the function is the result of the last
calculation that occured in the function. So to test this I deleted
the "return $sum;" line from the function. When the return line was
there, it returned the correct value. Without that line, it appears
to return undef.
Can anyone explain?
Thanks
------------------------------
Date: Sun, 19 Aug 2007 19:07:27 -0000
From: Zachary Turner <divisortheory@gmail.com>
Subject: Re: Newbie Perl question
Message-Id: <1187550447.842881.3480@x40g2000prg.googlegroups.com>
My apologies to anyone using title-threaded newsreaders such as Google
Groups, I should have chosen the title of my post more carefully :(
Zach
On Aug 19, 2:04 pm, Zachary Turner <divisorthe...@gmail.com> wrote:
> Hello,
>
> I'm just learning Perl and I'm going through a book and there was an
> exercise in one of the chapters to write a simple subroutine to add up
> all the values that were passed as arguments. Simple enough, I
> implemented this as follows:
>
> sub total {
> my $sum;
>
> foreach (@_) {
> $sum += $_;
> }
> return $sum;
>
> }
>
> However, in the same chapter it says that if you do not put a return
> statement, the return value of the function is the result of the last
> calculation that occured in the function. So to test this I deleted
> the "return $sum;" line from the function. When the return line was
> there, it returned the correct value. Without that line, it appears
> to return undef.
>
> Can anyone explain?
>
> Thanks
------------------------------
Date: Sun, 19 Aug 2007 21:20:21 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Newbie Perl question
Message-Id: <cu5hc35vt36mkvqdt5oafn53obbj0ccevh@4ax.com>
On Sun, 19 Aug 2007 19:07:27 -0000, Zachary Turner
<divisortheory@gmail.com> wrote:
>My apologies to anyone using title-threaded newsreaders such as Google
>Groups, I should have chosen the title of my post more carefully :(
Accepted! Please also do not top post since this is highly discouraged
here.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Sun, 19 Aug 2007 21:24:25 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Newbie Perl question
Message-Id: <p26hc3h0n9ea0lisrkktak50fom49ske7t@4ax.com>
On Sun, 19 Aug 2007 19:04:11 -0000, Zachary Turner
<divisortheory@gmail.com> wrote:
>However, in the same chapter it says that if you do not put a return
>statement, the return value of the function is the result of the last
>calculation that occured in the function. So to test this I deleted
^^^^^^^^^^^
^^^^^^^^^^^
>the "return $sum;" line from the function. When the return line was
>there, it returned the correct value. Without that line, it appears
>to return undef.
>
>Can anyone explain?
The official docs can. In fact
perldoc perlsub
says:
: If no "return" is found and if the last statement is an expression, its
: value is returned. If the last statement is a loop control structure
: like a "foreach" or a "while", the returned value is unspecified. The
: empty sub returns the empty list.
While I like the last-expression-is-returned feature, even if perl did
the "right" thing with loops, I wouldn't rely on it and use an explict
return() instead.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Sun, 19 Aug 2007 18:33:55 -0000
From: bcdixit <bhooshan.dixit@gmail.com>
Subject: Re: perl parse across multiple line in txt file
Message-Id: <1187548435.077889.192100@r23g2000prd.googlegroups.com>
sorry if I was not too clear. Those numbers are actually line numbers.
those numbers are not actually part of the text.
On Aug 18, 9:13 pm, Tad McClellan <ta...@seesig.invalid> wrote:
> bcdixit <bhooshan.di...@gmail.com> wrote:
> > i have a file with the following sample text
>
> > 1 create table xyz
> > 2 no before journal,
> > 3 no after journal
> > 4 (
> > 5 col1 integer,
> > 6 col2 integer,
> > 7 ...
> > 8 coln varchar(10)
> > 9 )
> > 10;
> > i want to use perl regex to search and replace text from the line that
> > starts with 'create'
>
> There is no line there that starts with 'create'.
>
> There is a line that starts with '1', and with '2', and ...
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Sun, 19 Aug 2007 12:35:10 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: perl parse across multiple line in txt file
Message-Id: <ZZqdnb9HnNodBlXbnZ2dnUVZ_jednZ2d@comcast.com>
bcdixit wrote:
> i have a file with the following sample text
>
> 1 create table xyz
...
> 10;
Forget about lines, this is a case where you should be using ";" instead
of "\n" as the record delimiter. Check the docs for "input record delimiter".
------------------------------
Date: Sun, 19 Aug 2007 15:14:34 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Symbolic representation of logical operators
Message-Id: <u7Zxi.2384$Wr3.395@trndny03>
Mark Hobley wrote:
> Some logical operators have symbolic representation. For example:
>
> The doubleampersand && represents the "and" operator
> The doublepipe || represents the "or" operator
> The pling ! represents the "not" operator
No, those are actually different operators because e.g. "and" and "&&" have
different precedences.
jue
------------------------------
Date: Sun, 19 Aug 2007 17:26:38 +0200
From: Josef Moellers <5502109103600001@t-online.de>
Subject: Re: Symbolic representation of logical operators
Message-Id: <fa9nff$cb7$00$1@news.t-online.com>
Mark Hobley wrote:
> Some logical operators have symbolic representation. For example:
>
> The doubleampersand && represents the "and" operator
> The doublepipe || represents the "or" operator
> The pling ! represents the "not" operator
>
> What is the symbolic representation for the "xor" operator?
> I don't appear to be able to find this in any documentation.
The caret "^".
BTW as Jürgen has pointed out, "&&" is not a bitwise and but rather a
logical and and it short-circuits, likewise "||" is a logical or:
sub l1 {
print "l1\n"; return 1;
}
sub l2 {
print "l2\n"; return 0;
}
print l2 && l1, "\n";
print l1 || l2, "\n";
You want "&" and "|".
Josef
--
Mails please to josef dot moellers
and I'm on gmx dot de.
------------------------------
Date: Sun, 19 Aug 2007 19:40:23 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Symbolic representation of logical operators
Message-Id: <l30hc399moejo1mgmtr1d6b9fspme7si5q@4ax.com>
On Sun, 19 Aug 2007 17:26:38 +0200, Josef Moellers
<5502109103600001@t-online.de> wrote:
>> Some logical operators have symbolic representation. For example:
>>
>> The doubleampersand && represents the "and" operator
>> The doublepipe || represents the "or" operator
>> The pling ! represents the "not" operator
>>
>> What is the symbolic representation for the "xor" operator?
>> I don't appear to be able to find this in any documentation.
>
>The caret "^".
Except that it is a bitwise operator.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Sun, 19 Aug 2007 18:08:07 GMT
From: markhobley@hotpop.deletethisbit.com (Mark Hobley)
Subject: Re: Symbolic representation of logical operators
Message-Id: <o7dmp4-ktu.ln1@neptune.markhobley.yi.org>
Josef Moellers <5502109103600001@t-online.de> wrote:
>
> The caret "^".
>
> BTW as Jürgen has pointed out, "&&" is not a bitwise and but rather a
> logical and and it short-circuits, likewise "||" is a logical or:
I am not looking for a bitwise operator, I am looking for a the
symbolic form of a logical exclusive or to compliment the && and || operators,
The logic being as follows:
false (symbol) false = false
false (symbol) true = true
true (symbol) false = true
true (symbol) true = false (a conventional || or would return true here)
I hope that makes sense.
Mark.
--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE
Email: markhobley at hotpop dot donottypethisbit com
http://markhobley.yi.org/
------------------------------
Date: Sun, 19 Aug 2007 12:31:06 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Symbolic representation of logical operators
Message-Id: <m6OdnT6tkdoRB1XbnZ2dnUVZ_qiinZ2d@comcast.com>
Mark Hobley wrote:
> Some logical operators have symbolic representation. For example:
>
> The doubleampersand && represents the "and" operator
> The doublepipe || represents the "or" operator
> The pling ! represents the "not" operator
>
> What is the symbolic representation for the "xor" operator?
> I don't appear to be able to find this in any documentation.
No, "&&" does not represent the "and" operator. Those are two
different operators - they have different precedences. If you
replace one for the other in a program you will often get different
results; they are not interchangeable.
The answer to your question is that there is none.
-Joe
------------------------------
Date: Sun, 19 Aug 2007 22:03:16 +0200
From: Josef Moellers <5502109103600001@t-online.de>
Subject: Re: Symbolic representation of logical operators
Message-Id: <faa7m7$de7$00$1@news.t-online.com>
Mark Hobley wrote:
> Josef Moellers <5502109103600001@t-online.de> wrote:
>> The caret "^".
>>
>> BTW as Jürgen has pointed out, "&&" is not a bitwise and but rather a
>> logical and and it short-circuits, likewise "||" is a logical or:
>
> I am not looking for a bitwise operator, I am looking for a the
> symbolic form of a logical exclusive or to compliment the && and || operators,
>
> The logic being as follows:
>
> false (symbol) false = false
> false (symbol) true = true
> true (symbol) false = true
> true (symbol) true = false (a conventional || or would return true here)
>
> I hope that makes sense.
OK, my fault.
How about "!="?
for my $v1 (0,1) {
for my $v2 (0,1) {
print "$v1 != $v2 = ", $v1 != $v2, "\n";
}
}
Josef
--
Mails please to josef dot moellers
and I'm on gmx dot de.
------------------------------
Date: Sun, 19 Aug 2007 20:08:11 GMT
From: markhobley@hotpop.deletethisbit.com (Mark Hobley)
Subject: Re: Symbolic representation of logical operators
Message-Id: <eoimp4-61v.ln1@neptune.markhobley.yi.org>
Mark Hobley <markhobley@hotpop.deletethisbit.com> wrote:
> I am not looking for a bitwise operator, I am looking for a the
> symbolic form of a logical exclusive or to compliment the && and || operators,
print (2 && 3); # 3, Ok, I was expecting 1, but checked documentation
print (0 && 2); # 0, Ok
print (2 || 3); # 3, Ok, again documented
print (0 || 2); # 2, Ok documented
print (2 ^^ 3); # Syntax error, I hoped 0 (true xor true = false)
print (7 ^ 2); # 5, Ok, but that is a bitwise operator. I am testing logicals
print (7 xor 2); # Empty string, I was expecting 0 (true xor true = false)
I wondered why the xor gives an empty string, and not the second values like
the && and ||, so I thought maybe its because its a named operator, so I tried:
print (0 or 0); # 0, Ok
print (0 and 0); # 0, Ok
print (0 xor 0); # Empty string, why not a 0, like and and or
I know the empty strings and non zero values are fine for logicals, I just
didn't expect some of the results.
Regards,
Mark.
--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE
Email: markhobley at hotpop dot donottypethisbit com
http://markhobley.yi.org/
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 771
**************************************