[29566] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 810 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 30 21:09:48 2007

Date: Thu, 30 Aug 2007 18:09:08 -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           Thu, 30 Aug 2007     Volume: 11 Number: 810

Today's topics:
    Re: 2D array of real numbers <anno4000@radom.zrz.tu-berlin.de>
    Re: great and better hash eval <tadmc@seesig.invalid>
    Re: How to continue process without waiting for the out <ben@morrow.me.uk>
    Re: How to make this case insenstive <rvtol+news@isolution.nl>
    Re: Important Research Project ArarghMail708NOSPAM@NOT.AT.Arargh.com
    Re: Important Research Project <edgrsprj@ix.netcom.com>
    Re: Important Research Project <edgrsprj@ix.netcom.com>
    Re: Mac: Perl script that will run when double-clicked <ben@morrow.me.uk>
    Re: Searching in a line <lerameur@yahoo.com>
    Re: Searching in a line <lerameur@yahoo.com>
    Re: Searching in a line <jurgenex@hotmail.com>
    Re: Searching in a line <lerameur@yahoo.com>
    Re: Searching in a line <jurgenex@hotmail.com>
    Re: Searching in a line <dummy@example.com>
    Re: Searching in a line <lerameur@yahoo.com>
    Re: Searching in a line <jurgenex@hotmail.com>
        Solaris 10 gcc 3.4.6 perl compile error HELP! <the.evil.alien@gmail.com>
    Re: Solaris 10 gcc 3.4.6 perl compile error HELP! <ben@morrow.me.uk>
    Re: why warn on undefined $1? <rvtol+news@isolution.nl>
    Re: win32::sqlserver not able to sql_insert <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 30 Aug 2007 22:23:44 +0200
From: Anno Siegel <anno4000@radom.zrz.tu-berlin.de>
Subject: Re: 2D array of real numbers
Message-Id: <5jonagFkgc8U1@mid.dfncis.de>

On 2007-08-30 16:44:57 +0200, "Petr Vileta" <stoupa@practisoft.cz> said:

[ $array[ $i]->[ $k] vs. $array[ $i][ $k] ]

> Right too. I remember that in some case $array[row][col] generate error 
> at runtime, some like "$array[row][col] is not allowed while use strict 
> refs", but I forgot details and context.

No, there is no such runtime error.  An arrow (->) that appears in the 
middle of a pair of
closing and opening parentheses (of any kind) can be dropped without a 
change in meaning.

Anno



------------------------------

Date: Thu, 30 Aug 2007 23:10:11 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: great and better hash eval
Message-Id: <slrnfdejht.9lv.tadmc@tadmc30.sbcglobal.net>

john swilting <john.swilting@wanadoo.fr> wrote:


John,


Please do not drop your litter in our newsgroup.

This is a nice place, we don't want trash lying all around.

Thank you.



-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Thu, 30 Aug 2007 21:44:06 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: How to continue process without waiting for the output of system()?
Message-Id: <mpmjq4-dt3.ln1@osiris.mauzo.dyndns.org>


Quoth Cod <zencod@gmail.com>:
> For example , I wrote:
> 
> system("calc");
> print "hello";
> 
> Before the calc program is closed, the print statement will not
> excute.
> 
> Any way to change the behavior?
> I have tried fork, and system("calc&"), all failed.

The (approximate) equivalent of 'cmd &' under NT is 'start cmd'. So

    system "start calc";

As others have said, fork ought to work anyway.

Ben



------------------------------

Date: Thu, 30 Aug 2007 23:17:47 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: How to make this case insenstive
Message-Id: <fb7jg1.1n0.1@news.isolution.nl>

Uri Guttman schreef:
> Ruud:
>> it_says_BALLS_on_your forehead:
>>> Daniel:

>>>> I am checking to see if the name is the same name as in $row[1]
>>>> but should be case insensitive.
>>>>
>>>> my $line = DBI::neat_list(\@row, 70, ',');
>>>> if ($name ne $row[1])
>>>> do
>>>> error message
>>>
>>> an alternative to the lc() or uc() solution is to use a regex
>>> (although this is probably less efficient).
>>>
>>> if ( $name =~ m/$row[1]/i ) {
>>> do {
>>> blah
>>
>> Missing: quotemeta.
>
> also missing regex anchors which are needed since he did 'ne'.

ACK.

He did mention "the name in $var" though, which can be read as that $var
can contain more than just the name.

-- 
Affijn, Ruud

"Gewoon is een tijger."



------------------------------

Date: Thu, 30 Aug 2007 16:26:19 -0500
From: ArarghMail708NOSPAM@NOT.AT.Arargh.com
Subject: Re: Important Research Project
Message-Id: <0dded397gquvo23fjvjfta1131evcb4or0@4ax.com>

On Thu, 30 Aug 2007 09:45:50 -0400, CBFalconer <cbfalconer@yahoo.com>
wrote:

>"E.D.G." wrote:
>> 
>> This report is being posted to a number of Internet Newsgroups to
>> see if there are any experienced computer programmers who would
>> like to provide some assistance with an effort to develop a Perl
>> language computer program.
>
>Where is Perl described in the C standard?  This seems rather OT.
>
A little OT for basic groups, too.  Followups set.

Fortran group dropped, too.
-- 
ArarghMail708 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the extra stuff from the reply address.


------------------------------

Date: Thu, 30 Aug 2007 19:55:43 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: Important Research Project
Message-Id: <13deppf942e6u45@corp.supernews.com>

"dave_w" <dave.willmer@gmail.com> wrote in message
news:1188500139.411988.127100@q5g2000prf.googlegroups.com...

My main Perl program is presently about 3500 lines of code long and 160 KB
in size. So I am not too anxious to translate it into another language.

The problem I am having is largely with the mechanics of linking modules to
the Perl compiler etc.  So I am looking for experts who can help with
cookbook instructions, start with step 1, step 2, step 3 etc.

With trying to find a chart program to use for example, there appear to be a
number of them.  But from examining their instructions it looks like most of
them must also be linked to a third program called Gnuplot.  And that
increases the complexity of getting something running.




------------------------------

Date: Thu, 30 Aug 2007 20:04:31 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: Important Research Project
Message-Id: <13deq9nj9atft62@corp.supernews.com>

"CBFalconer" <cbfalconer@yahoo.com> wrote in message
news:46D6CA0E.E66ED5C8@yahoo.com...
> "E.D.G." wrote:


> Where is Perl described in the C standard?  This seems rather OT.

It has been my experience that a person who is an expert with one computer
language can usually do reasonably well when working with other languages.
I am trying to find some people who can assist with getting a Perl program
running.  It would probably be easier for expert programmers in any language
to help with this type of work compared with people such as myself who are
not experts in any programming language.






------------------------------

Date: Thu, 30 Aug 2007 21:37:48 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Mac: Perl script that will run when double-clicked
Message-Id: <sdmjq4-dt3.ln1@osiris.mauzo.dyndns.org>


Quoth amirkarger@gmail.com:
> On Aug 29, 5:54 pm, Anno Siegel <anno4...@mailbox.zrz.tu-berlin.de>
> wrote:
> > On 2007-08-29 06:17:58 +0200, amirkar...@gmail.com said:
> >
> > > On Aug 22, 1:28 pm, amirkar...@gmail.com wrote:
> > > 1) You need to chmod +x the script, or it won't run. Which sort of
> > > defeats the purpose of creating adouble-clickable program, doesn't
> > > it?
> >
> > How so?  What do you consider the purpose of making a perl script clickable?
> >
> > Anno
> 
> Good point.
> 
> The idea here is that I'm going to have downloadable files that the
> user saves to their disk so they can click on it & run without ever
> needing to open a Terminal themselves or type stuff on a command
> line.

They don't... it's perfectly possible to chmod a file through the GUI.
In any case, this should be regarded as a security feature of MacOSX: the
point being that a user has to take affirmative action before a random
downloaded file can be executed (yes, I realise there are many ways
around this... still, it's worth something :) ).

Ben



------------------------------

Date: Thu, 30 Aug 2007 13:27:47 -0700
From:  lerameur <lerameur@yahoo.com>
Subject: Re: Searching in a line
Message-Id: <1188505667.941015.108260@l22g2000prc.googlegroups.com>

I wrote this now: If it finds the work beth in the line, then is
splits the line. otherwise print an error.
Now there is beth in the file ( i added it) but the program always
skips to the else statement, end prints it twice.
How should I modify the search  if (/^beth/) ?

#!/usr/bin/perl

my $log = 'file.txt';

open my $fh, '<', $log or die "cannot open '$log': $!\n";

while ($data=<$fh>) {

	if (/beth/) 	{ #matches only if beth is in line
		my $val =(split(/,/,$data))[3];
		print $val, "\n";
					}
	else {
		print ("Nope, not working...:\n");
		}

					}

close $fh;





------------------------------

Date: Thu, 30 Aug 2007 13:36:48 -0700
From:  lerameur <lerameur@yahoo.com>
Subject: Re: Searching in a line
Message-Id: <1188506208.246501.268710@z24g2000prh.googlegroups.com>

did not see the second page,

Added the strict and warnings.

I do not know how the multiple post got there.

k



------------------------------

Date: Thu, 30 Aug 2007 20:39:03 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Searching in a line
Message-Id: <HVFBi.2195$_A5.786@trndny03>

lerameur wrote:
> I wrote this now: If it finds the work beth in the line, then is
> splits the line. otherwise print an error.
> Now there is beth in the file ( i added it) but the program always
> skips to the else statement, end prints it twice.
> How should I modify the search  if (/^beth/) ?


> while ($data=<$fh>) {

Here you are reading each line into $data

> if (/beth/) { #matches only if beth is in line

and here you are matching /beth/ against the default $_.

Is that what you meant to do?

jue 




------------------------------

Date: Thu, 30 Aug 2007 13:50:57 -0700
From:  lerameur <lerameur@yahoo.com>
Subject: Re: Searching in a line
Message-Id: <1188507057.706567.221360@q3g2000prf.googlegroups.com>

On Aug 30, 4:39 pm, "J=FCrgen Exner" <jurge...@hotmail.com> wrote:
> lerameur wrote:
> > I wrote this now: If it finds the work beth in the line, then is
> > splits the line. otherwise print an error.
> > Now there is beth in the file ( i added it) but the program always
> > skips to the else statement, end prints it twice.
> > How should I modify the search  if (/^beth/) ?
> > while ($data=3D<$fh>) {
>
> Here you are reading each line into $data
>
> > if (/beth/) { #matches only if beth is in line
>
> and here you are matching /beth/ against the default $_.
>
> Is that what you meant to do?
>
> jue

so you are saying this is no good:
$data=3D<$fh>

should I putting this into an array then ?

k



------------------------------

Date: Thu, 30 Aug 2007 20:57:13 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Searching in a line
Message-Id: <JaGBi.2429$2p5.2293@trndny05>

lerameur wrote:
> On Aug 30, 4:39 pm, "Jürgen Exner" <jurge...@hotmail.com> wrote:
>> lerameur wrote:
>>> I wrote this now: If it finds the work beth in the line, then is
>>> splits the line. otherwise print an error.
>>> Now there is beth in the file ( i added it) but the program always
>>> skips to the else statement, end prints it twice.
>>> How should I modify the search  if (/^beth/) ?
>>> while ($data=<$fh>) {
>>
>> Here you are reading each line into $data
>>
>>> if (/beth/) { #matches only if beth is in line
>>
>> and here you are matching /beth/ against the default $_.
>>
>> Is that what you meant to do?
>>
>> jue
>
> so you are saying this is no good:
> $data=<$fh>

No. I am saying you should make up your mind if you want to use the default 
$_ or your own $data. Either is ok, but not both.

> should I putting this into an array then ?

Only if you insist on wasting memory.

jue 




------------------------------

Date: Thu, 30 Aug 2007 21:00:36 GMT
From: "John W. Krahn" <dummy@example.com>
Subject: Re: Searching in a line
Message-Id: <UdGBi.2601$bO6.1617@edtnps89>

lerameur wrote:
> On Aug 30, 4:39 pm, "Jürgen Exner" <jurge...@hotmail.com> wrote:
>> lerameur wrote:
>>> I wrote this now: If it finds the work beth in the line, then is
>>> splits the line. otherwise print an error.
>>> Now there is beth in the file ( i added it) but the program always
>>> skips to the else statement, end prints it twice.
>>> How should I modify the search  if (/^beth/) ?
>>> while ($data=<$fh>) {
>> Here you are reading each line into $data
>>
>>> if (/beth/) { #matches only if beth is in line
>> and here you are matching /beth/ against the default $_.
>>
>> Is that what you meant to do?
>>
>> jue
> 
> so you are saying this is no good:
> $data=<$fh>
> 
> should I putting this into an array then ?

No, that is *not* what he is saying.  You should either use $data in both places:

while ( my $data = <$fh> ) {

	if ( $data =~ /beth/ ) 	{ #matches only if beth is in line

Or use $_ in both places:

while ( <$fh> ) {

	if ( /beth/ ) 	{ #matches only if beth is in line




John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


------------------------------

Date: Thu, 30 Aug 2007 14:01:29 -0700
From:  lerameur <lerameur@yahoo.com>
Subject: Re: Searching in a line
Message-Id: <1188507689.406777.49290@z24g2000prh.googlegroups.com>

On Aug 30, 4:57 pm, "J=FCrgen Exner" <jurge...@hotmail.com> wrote:
> lerameur wrote:
> > On Aug 30, 4:39 pm, "J=FCrgen Exner" <jurge...@hotmail.com> wrote:
> >> lerameur wrote:
> >>> I wrote this now: If it finds the work beth in the line, then is
> >>> splits the line. otherwise print an error.
> >>> Now there is beth in the file ( i added it) but the program always
> >>> skips to the else statement, end prints it twice.
> >>> How should I modify the search  if (/^beth/) ?
> >>> while ($data=3D<$fh>) {
>
> >> Here you are reading each line into $data
>
> >>> if (/beth/) { #matches only if beth is in line
>
> >> and here you are matching /beth/ against the default $_.
>
> >> Is that what you meant to do?
>
> >> jue
>
> > so you are saying this is no good:
> > $data=3D<$fh>
>
> No. I am saying you should make up your mind if you want to use the defau=
lt
> $_ or your own $data. Either is ok, but not both.

I do not make difference between the two. This is new to me.
I guess I will sue the default one.

k



------------------------------

Date: Fri, 31 Aug 2007 00:15:18 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Searching in a line
Message-Id: <q4JBi.2965$2p5.2437@trndny05>

lerameur wrote:
> On Aug 30, 4:57 pm, "Jürgen Exner" <jurge...@hotmail.com> wrote:
>> lerameur wrote:
>>> On Aug 30, 4:39 pm, "Jürgen Exner" <jurge...@hotmail.com> wrote:
>>>> lerameur wrote:
>>>>> while ($data=<$fh>) {
>>
>>>> Here you are reading each line into $data
>>
>>>>> if (/beth/) { #matches only if beth is in line
>>
>>>> and here you are matching /beth/ against the default $_.
>>
>> No. I am saying you should make up your mind if you want to use the
>> default $_ or your own $data. Either is ok, but not both.
>
> I do not make difference between the two. This is new to me.

Oh come on! Do you really expect if you are setting one variable named $data 
another totally unrelated variable named $_ would magically assume the same 
value? How long have you been programming?

> I guess I will sue the default one.

Ok, then don't assign the read line to $data:

    while (<$fh>) {

jue 




------------------------------

Date: Thu, 30 Aug 2007 13:20:51 -0700
From:  mancat <the.evil.alien@gmail.com>
Subject: Solaris 10 gcc 3.4.6 perl compile error HELP!
Message-Id: <1188505251.039107.269890@q4g2000prc.googlegroups.com>

I am tring to compile Perl 5.8.8 on a Solaris 10 box with gcc 3.4.6
and am getting this error.  I am at a total loss, So if someone could
point me to a resource or in the right direction that would be
GREAT!!!!!

thanks
-mancat



Checking your choice of C compiler and flags for coherency...
I've tried to compile and run the following simple program:

#include <stdio.h>
int main() { printf("Ok\n"); return(0); }

I used the command:

        gcc -o try -O -fno-strict-aliasing -pipe -Wdeclaration-after-
statement -I/usr/local/include -L/usr/local/lib try.c -lsocket -lnsl -
lgdbm -ldb -ldl -lm -lc
         ./try

and I got the following output:

ld: fatal: library -ldb: not found
ld: fatal: File processing errors. No output written to try
collect2: ld returned 1 exit status
I can't compile the test program.
(The supplied flags or libraries might be incorrect.)



------------------------------

Date: Thu, 30 Aug 2007 23:56:49 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Solaris 10 gcc 3.4.6 perl compile error HELP!
Message-Id: <hiujq4-5de.ln1@osiris.mauzo.dyndns.org>


Quoth mancat <the.evil.alien@gmail.com>:
> I am tring to compile Perl 5.8.8 on a Solaris 10 box with gcc 3.4.6
> and am getting this error.  I am at a total loss, So if someone could
> point me to a resource or in the right direction that would be
> GREAT!!!!!
> 
> thanks
> -mancat
> 
> 
> 
> Checking your choice of C compiler and flags for coherency...
> I've tried to compile and run the following simple program:
> 
> #include <stdio.h>
> int main() { printf("Ok\n"); return(0); }
> 
> I used the command:
> 
>         gcc -o try -O -fno-strict-aliasing -pipe -Wdeclaration-after-
> statement -I/usr/local/include -L/usr/local/lib try.c -lsocket -lnsl -
> lgdbm -ldb -ldl -lm -lc
>          ./try
> 
> and I got the following output:
> 
> ld: fatal: library -ldb: not found
> ld: fatal: File processing errors. No output written to try
> collect2: ld returned 1 exit status
> I can't compile the test program.
> (The supplied flags or libraries might be incorrect.)

How did you run Configure? What is the whole output of Configure? Do you
have a -ldb?

Ben


------------------------------

Date: Thu, 30 Aug 2007 23:37:00 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: why warn on undefined $1?
Message-Id: <fb7kcp.1j0.1@news.isolution.nl>

ihok@hotmail.com schreef:
> Ben Morrow:
>> Or (better IMHO), use look-around assertions:
>> 
>>     my $str = 'color colored tricolor floor';
>>     $str =~ s/ (?<= col) or (?= (?: ed|ing|s)? \b) /our/gx;
>>     print $str;
>>     # colour coloured tricolour floor
> 
> Whoa. That's heavy.

       $str =~ s{ (?<= colo) (?= r(?: ed|ing|s|) \b) }
                           {u}gx;

-- 
Affijn, Ruud

"Gewoon is een tijger."


------------------------------

Date: Thu, 30 Aug 2007 21:29:03 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: win32::sqlserver not able to sql_insert
Message-Id: <ftljq4-dt3.ln1@osiris.mauzo.dyndns.org>


Quoth Digger <michel.knight@cgi.com>:
> Hi,
> I hope that anybody have info on this, i've install and have
> win32::sqlserver working properly.
> I'm able to retrieve data from my database with the select statement.
> 
> My problem is with sql_insert here my code:
> 
> my $table = "icon";
> #my %values=("iconID"=>'3',"link"=>"something");
> #my %values=("iconID"=>3,"link"=>"something");
> #my %values=("iconID"=>"3","link","something");
> #my %values=("iconID",3,"link","something");
> my %values=("iconID","3","link","somethingElse");
> 
> $sqlsrv->sql_insert($table,\%values);
> 
> Table is call icon, iconID is a primary key and an integer, link is a
> varchar.
> 
> Here the error I get all the time:
> SQL Server message 515, Severity 16, State 2, Server WEB-T-
> SQL1\DVSQBQL
> Line 1
> Cannot insert the value NULL into column 'iconid', table
> 'master.dbo.Icon'; column does not allow nulls. INSERT fails.
>     1> EXEC sp_executesql N'INSERT icon (iconID, link)
>     2>    VALUES (@P1, @P2)',
>     3>      N'@P1 int, @P2 varchar(13)',
>     4>      @P1 = NULL, @P2 = 'somethingElse'
> The statement has been terminated.
> 
> It look like it doesn't like my value for IconID, what's missing...
> take me out of my misery.

Type int, value NULL seems to be what Win32::SqlServer inserts when it
doesn't recognise the column name. Since SQL Server seems to think the
column is called 'iconid', not 'iconID', perhaps you should try that.

Is there a good reason you're not using DBI? While it may not support so
much of the SQL-Server-specific API, it's probably better tested.

Ben



------------------------------

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 810
**************************************


home help back first fref pref prev next nref lref last post