[12669] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 78 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 8 13:07:11 1999

Date: Thu, 8 Jul 1999 10:05:14 -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, 8 Jul 1999     Volume: 9 Number: 78

Today's topics:
        'making' perl <hummerth@egr.msu.edu>
    Re: Autodecrementing strings. <jcreed@cyclone.jprc.com>
        checking Perl offline <stephen.aze@zetnet.co.uk>
    Re: checking Perl offline <tchrist@mox.perl.com>
    Re: checking Perl offline <swiftkid@bigfoot.com>
    Re: checking Perl offline <kistler@fnmail.com>
    Re: Exclusive file IO <joewong@dog.ima.net>
    Re: Floating Point Number With Time Function <troyknight@troyknight.eurobell.co.uk>
    Re: fork() in Win32 <David.Boyce@fmr.com>
    Re: How do YOU format your << data? <tchrist@mox.perl.com>
        How to display result screen at a time? rajsharda@my-deja.com
    Re: How to format date and year string? (I R A Aggie)
    Re: I need to hide the source rdosser@my-deja.com
    Re: Language-Suck-O-Meter ? <lusol@Pandora.CC.Lehigh.EDU>
        Login on my website <programmaholic@hotmail.com>
        Min/Max Problem <mykkam@krypton.mankato.msus.edu>
    Re: Min/Max Problem <rick.delaney@home.com>
    Re: Min/Max Problem <swiftkid@bigfoot.com>
    Re: Min/Max Problem <cw@dwc.ch>
    Re: Min/Max Problem <cw@dwc.ch>
        Need Expert Help! dafydd1@my-deja.com
    Re: Need Expert Help! <martin@adoma.se>
    Re: Need Expert Help! <rick.delaney@home.com>
    Re: Need Expert Help! <dafydd@gointernet.co.uk>
    Re: Need Expert Help! <rick.delaney@home.com>
        Need help with Win32::ODBC <gio98dr@yahoo.com>
    Re: Need help with Win32::ODBC <rick.delaney@home.com>
    Re: newbie help... should be simple <dodger@dodger.org>
        newbie question <vit@lipetsk.ru>
    Re: newbie question <swiftkid@bigfoot.com>
    Re: newbie question <tturton@ntx.waymark.net>
    Re: newbie question <kistler@fnmail.com>
        Pattern match counting <offwhite@tidalwave.net>
    Re: Perl Everywhere : That's what I want (Philip 'Yes, that's my address' Newton)
        Perl Installation errors on Solaris 2.5 system <paul.glidden@unisys.com>
    Re: Problem with a SQL statement in a Perl script <rhrh@hotmail.com>
    Re: regex to eat all html tags (or check your faqs, Jac sethr@crocker.com
    Re: REMOTE_HOST never gives host... <tmornini@netcom9.netcom.com>
        Simple.pm Error <alex@exbook.com>
    Re: Simple.pm Error <kistler@fnmail.com>
    Re: throw me a bone here!........please <kenhirsch@myself.com>
        totally lost on an error message <dodger@dodger.org>
    Re: Which is better, Perl, Cold Fusion or... <toby@venice.cas.utk.edu>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Thu, 08 Jul 1999 12:49:54 -0400
From: henning hummert <hummerth@egr.msu.edu>
Subject: 'making' perl
Message-Id: <3784D6B2.15D29CB3@egr.msu.edu>

hi,
i am trying to install a new version of perl on a linux box. problem is:
i can run the Configure script without any trouble, make dep is running
well too, but when i try to run make i get an error saying : error in
makefile pointing to the last line of it.

has anybody an idea how to solve this problem?



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

Date: 08 Jul 1999 11:05:20 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: Autodecrementing strings.
Message-Id: <a1r9mjdvwv.fsf@cyclone.jprc.com>

Lee Benfield <lbenfie1@avwb001.aveley.ford.com> writes:
> [...] which FAQ did I miss? [...]

$ perldoc perlop
 ...
Auto-increment and Auto-decrement

       "++" and "--" work as in C.  That is, if placed before a
       variable, they increment or decrement the variable before
       returning the value, and if placed after, increment or
       decrement the variable after returning the value.

       The auto-increment operator has a little extra builtin
       magic to it.  If you increment a variable that is numeric,
       or that has ever been used in a numeric context, you get a
       normal increment.  If, however, the variable has been used
       in only string contexts since it was set, and has a value
       that is not the empty string and matches the pattern /^[a-
       zA-Z]*[0-9]*$/, the increment is done as a string,
       preserving each character within its range, with carry:

           print ++($foo = '99');      # prints '100'
           print ++($foo = 'a0');      # prints 'a1'
           print ++($foo = 'Az');      # prints 'Ba'
           print ++($foo = 'zz');      # prints 'aaa'

       The auto-decrement operator is not magical.
                                      ^^^^^^^^^^^
 ...

Not sure why it was never implemented, but possibly
the thought of someone doing

 $foo = "a";
 $foo--;

might have something to do with it.

---Jason


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

Date: Thu, 8 Jul 1999 17:17:55 +0100
From: Stephen Aze <stephen.aze@zetnet.co.uk>
Subject: checking Perl offline
Message-Id: <1999070817175566754@zetnet.co.uk>

This would seem to me to be the first question for anyone wanting to 
give Perl a try, but I can't find the answer anywhere...

I want to give Perl a try, and would like to do all my mistakes off-line.  
So how do I run my Perl/CGI applications locally, in a simulated 
'Net environment, rather than uploading to my server etc?  Solutions 
not requiring the expenditure of money preferred.

Thanks in advance.

-- 
stephen.aze@zetnet.co.uk





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

Date: 8 Jul 1999 10:32:12 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: checking Perl offline
Message-Id: <3784d28c@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Stephen Aze <stephen.aze@zetnet.co.uk> writes:
:This would seem to me to be the first question for anyone wanting to 
:give Perl a try, but I can't find the answer anywhere...
:
:I want to give Perl a try, and would like to do all my mistakes off-line.  

You use pencil and paper.

:So how do I run my Perl/CGI applications locally, in a simulated 
:'Net environment, rather than uploading to my server etc?  

s/uploading/copying/

:Solutions 
:not requiring the expenditure of money preferred.

Wait. Offline means away from the computer.  You know, analogue.
It doesn't mean that your internetty is brokey.  Anyway, the net is
irrelevant to running perl on your system.  You just run it from the
command line.  For icky web sillinesses, read the CGI.pm manpage which
shows how to do the simulated environment.  And do try a CGI newsgroup.

Darn it, when is somebody going to write a Babelfish module to go from
Prisoner of Bill consumerist mumblings to regular programmer technical
talk?  Sigh.  I can't keep up with the way they take our words and
break them.  Just lately I heard on the radio "Log on to something.com"
when all the mean is "Connect to http://www.something.com"!  These
people wouldn't know a login if they saw it.  GRRR!

--tom
-- 
"I discount everything Dijkstra has to say because he doesn't actually
run his programs" --Rob Pike, On Dijkstra's belief that bugs in your
program are a moral failure to prove your program mathematically correct.


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

Date: Thu, 8 Jul 1999 21:29:00 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: checking Perl offline
Message-Id: <7m3mtq$h2e2@news.cyber.net.pk>

> I want to give Perl a try, and would like to do all my mistakes off-line.
> So how do I run my Perl/CGI applications locally, in a simulated
> 'Net environment, rather than uploading to my server etc?  Solutions
> not requiring the expenditure of money preferred.

Perl for Win: http://www.activestate.com/ActivePerl/
Apache for Win: http://www.apache.org/dist/

I hope you can afford them both..... and the price is right.

Don't worry, they are 100% free :)

--
Faisal Nasim (the Whiz Kid)
Web: http://wss.hypermart.net/
AOL: Whiz Swift  ICQ: 4265451
FAX: (815) 846-2877




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

Date: Thu, 08 Jul 1999 18:30:17 +0200
From: Per Kistler <kistler@fnmail.com>
Subject: Re: checking Perl offline
Message-Id: <3784D219.79E1BC7E@fnmail.com>

Hi Stephen

You may run a www server locally. I do it on Linux and use
apache, which is for free. Even if you are not root, you
can run it on some free port number. (For win/mac I'm not
responsible:-)

Per.

Stephen Aze wrote:
> I want to give Perl a try, and would like to do all my mistakes off-line.
> So how do I run my Perl/CGI applications locally, in a simulated
> 'Net environment, rather than uploading to my server etc?  
> stephen.aze@zetnet.co.uk

-- 
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------


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

Date: Fri, 9 Jul 1999 00:29:12 +0800
From: "joe" <joewong@dog.ima.net>
Subject: Re: Exclusive file IO
Message-Id: <7m2jkr$bs5$1@m5.att.net.hk>

Got it. Thanks!

Philip 'Yes, that's my address' Newton ¼¶¼g©ó¤å³¹
<3784433A.C08FC4BC@gmx.net>...
>Anno Siegel wrote:
>>
>> Joe Wong <joewong@ima.com> wrote in comp.lang.perl.misc:
>> >Hi, in Perl, how can do excuslive file I/O? That is only one can read
and
>> >write to a file in the same time?
>>
>> perldoc -f flock
>
>Note also that AFAIK flock does not work under Windows 9* (it does under
>NT).
>
>Cheers,
>Philip




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

Date: Thu, 8 Jul 1999 16:17:41 +0100
From: "Troy Knight" <troyknight@troyknight.eurobell.co.uk>
Subject: Re: Floating Point Number With Time Function
Message-Id: <7m2f7j$cbi$1@aub.eurobell.net>

> the faqs should be in your perl\html\lib\pod directory, where perl is
> your root perl directory.

Okay, I have four subdirectories in the perl root directory, bin, docs, eg
and lib. No html! The only Pod directory in these directories contains
functions.pm and text.pm. I will take another look at the Activestate
website!

>
> for printing out a certain number of digits, i think you'll want to
> use sprintf.  look at the docs.  you might need to review printf as
> well.
>
> hope this helps,
>

Okay, will have a look, thanks.

> --
> John Borwick




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

Date: Thu, 08 Jul 1999 11:06:29 -0400
From: David Boyce <David.Boyce@fmr.com>
Subject: Re: fork() in Win32
Message-Id: <3784BE75.333D66FC@fmr.com>

iqa wrote:
> 
> Is there any way I can do like:
>         exec @command_list if (!fork());
> 
> under Win32 environment where fork() is not suppported.
> 
> system("@command_list") almost does it, but the problem is it waits the
> command to complete its execution.

It's not really a fork but the following construct:

	system 1, qw(notepad);

shows how to exec a program and continue asynchronously.

-David Boyce


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

Date: 8 Jul 1999 09:22:21 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How do YOU format your << data?
Message-Id: <3784c22d@cs.colorado.edu>
Keywords: gelatin 

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Ian Smith <iansmith@pepper.ncinter.net> writes:
:So... anyone as picky as me have a nice-looking solution to this
:terrible monster?  

NAME
    perlfaq4 - Data Manipulation ($Revision: 1.49 $, $Date:
    1999/05/23 20:37:49 $)

DESCRIPTION
    The section of the FAQ answers question related to the
    manipulation of data as numbers, dates, strings, arrays, hashes,
    and miscellaneous data issues.

 .....

  Why don't my <<HERE documents work?

    Check for these three things:

    1. There must be no space after the << part.
    2. There (probably) should be a semicolon at the end.
    3. You can't (easily) have any space in front of the tag.
    If you want to indent the text in the here document, you can do
    this:

        # all in one
        ($VAR = <<HERE_TARGET) =~ s/^\s+//gm;
            your text
            goes here
        HERE_TARGET

    But the HERE_TARGET must still be flush against the margin. If
    you want that indented also, you'll have to quote in the
    indentation.

        ($quote = <<'    FINIS') =~ s/^\s+//gm;
                ...we will have peace, when you and all your works have
                perished--and the works of your dark master to whom you
                would deliver us. You are a liar, Saruman, and a corrupter
                of men's hearts.  --Theoden in /usr/src/perl/taint.c
            FINIS
        $quote =~ s/\s*--/\n--/;

    A nice general-purpose fixer-upper function for indented here
    documents follows. It expects to be called with a here document
    as its argument. It looks to see whether each line begins with a
    common substring, and if so, strips that off. Otherwise, it
    takes the amount of leading white space found on the first line
    and removes that much off each subsequent line.

        sub fix {
            local $_ = shift;
            my ($white, $leader);  # common white space and common leading string
            if (/^\s*(?:([^\w\s]+)(\s*).*\n)(?:\s*\1\2?.*\n)+$/) {
                ($white, $leader) = ($2, quotemeta($1));
            } else {
                ($white, $leader) = (/^(\s+)/, '');
            }
            s/^\s*?$leader(?:$white)?//gm;
            return $_;
        }

    This works with leading special strings, dynamically determined:

        $remember_the_main = fix<<'    MAIN_INTERPRETER_LOOP';
            @@@ int
            @@@ runops() {
            @@@     SAVEI32(runlevel);
            @@@     runlevel++;
            @@@     while ( op = (*op->op_ppaddr)() );
            @@@     TAINT_NOT;
            @@@     return 0;
            @@@ }
        MAIN_INTERPRETER_LOOP

    Or with a fixed amount of leading white space, with remaining
    indentation correctly preserved:

        $poem = fix<<EVER_ON_AND_ON;
           Now far ahead the Road has gone,
              And I must follow, if I can,
           Pursuing it with eager feet,
              Until it joins some larger way
           Where many paths and errands meet.
              And whither then? I cannot say.
                    --Bilbo in /usr/src/perl/pp_ctl.c
        EVER_ON_AND_ON

-- 
"A well-written program is its own heaven;
 a poorly-written program its own hell."


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

Date: Thu, 08 Jul 1999 15:11:53 GMT
From: rajsharda@my-deja.com
Subject: How to display result screen at a time?
Message-Id: <7m2f3e$dqn$1@nnrp1.deja.com>

Hi,

 I have backend as Sybase. I am using sybperl to connect to sybase from
perl.

 Whenever user executes a query(from the browser), the query is sent to
the sybase by perl and the results generated by sybase are sent back to
the browser.

 Is there a way to display the result as x number of rows (for example
50 rows) at a time, so that when the user reads it all, he can get the
next 50 rows (by clicking "more" button, for example) and so on.

 One way of doing this would be to keep track of the rowcount of the
last row of the result set and then next time display the result from
that row onwards. But is there any other way?

 Any help on this matter will be highly appreciated.

Thanx.

Raj


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 8 Jul 1999 14:57:53 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: How to format date and year string?
Message-Id: <slrn7o9f7r.fig.fl_aggie@thepentagon.com>

On Thu, 8 Jul 1999 06:43:47 -0400, joeyandsherry@mindspring.com
<joeyandsherry@mindspring.com>, in
<7m1vgv$e46$1@nntp3.atl.mindspring.net> wrote:

+ When your thirsty for it and you're so new...you haven't yet heard the last
+ echo of the word perl, you try anything.

Taking code from Matt's archive is like drinking from a mud flat.

James


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

Date: Thu, 08 Jul 1999 15:28:53 GMT
From: rdosser@my-deja.com
Subject: Re: I need to hide the source
Message-Id: <7m2g34$eas$1@nnrp1.deja.com>

In article <378437D7.B6AB8462@ingress.com>,
  ehpoole@ingress.com wrote:
>
> How is 'hiding' a decryption algorithm going to increase your security
> any?  Even if you did develop a brand new super-duper
> encryption/decryption algorithm of your very own, hiding it would not
> significantly improve the security of your data (you're only obscuring
> it).  The only way you can protect your data is to protect the key,
and if
> you are using anything less than public key encryption that means
> asbolutely - positively - not embedding the passphrase (aka
'password') in
> your program *period*.
>
> Sounds like a case of poor design to me.

This so far is the very best answer I've received.

There *is* a very poor design involved, for business reasons that are
beyond my control. The people who own/administer the host are the ones
we want to protect the data from, if you can believe that, so my private
key would not be very private. They're also not very smart/determined,
so obscurity may actually work - at any rate, it seems like the only
option I've got given the circs.

At any rate, for those who helped, thanks for the help. For those who
just made monkey music ... well, best wishes to you also.

Ralph Dosser


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 8 Jul 1999 15:23:18 GMT
From: "Stephen O. Lidie" <lusol@Pandora.CC.Lehigh.EDU>
Subject: Re: Language-Suck-O-Meter ?
Message-Id: <7m2fp6$1lke@fidoii.cc.Lehigh.EDU>

John Robson <as646@FreeNet.Carleton.CA> wrote:

> Could someone tell me where is the 'Language-Suck-O-Meter' site that used
> to be on the old host of The Perl Journal (www.tpj.com) ??

> Ever since TPJ was taken over by EarthWeb and hosted on the the
> itknowledge.com/tpj/ , some of the cool links were gone.
> I miss the language-suck-meter ... I used it to show my boss and
> colleagues live feedback on how cool Perl is in comparison to other languages.

> Could someone at EarthWeb put it back ?  Or could someone out there take
> it over and tell me where it is ?

Yes, I love that page.  Hey, do what I just did: try to go there, get their
missing link page, and report it to them.  On second, thought, don't do
that.  Hopefully, 1 report is enough.



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

Date: Thu, 8 Jul 1999 20:32:31 +0530
From: "Programmaholic" <programmaholic@hotmail.com>
Subject: Login on my website
Message-Id: <7m3j5o$8te$1@news.vsnl.net.in>

Hi,

I would like to know how to make a login system on my website. I would like
to give different things to different people depending on their user profil,
eg give games to children, programming stuff to programmers, jokes to
teenagers, etc...

I would also like to create an email system like hotmail, just for
educational purpose (to understand how it works).

I work in Perl - cgi.

Any comments are welcome.

Alok.




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

Date: Thu, 8 Jul 1999 10:33:47 -0500
From: Mark Mykkanen <mykkam@krypton.mankato.msus.edu>
To: mykkam@mail.mankato.msus.edu
Subject: Min/Max Problem
Message-Id: <Pine.OSF.3.96.990708102218.12705A-100000@krypton.mankato.msus.edu>


Why doesn't the maximum in this program work correctly?  The minimum value works fine but it
 also matches numbers over 11 digits.

open(INPUT,"sample");
while(chomp($value = <INPUT>))
{
  print $value,"\n" if $value =~ /\d{7,11}/;
}

exit;

sample
---BEGIN---
45621
4392155
54567
5465132
545
545
dlkja
7
9879067012626165675672157652875387156876532173276876876329868676328763278643256532976871263876876
65465487877
54545655329902
5454565532
6666666666
7777777774
456
25247
6365531
kjdsjhh
---END---




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

Date: Thu, 08 Jul 1999 16:20:07 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Min/Max Problem
Message-Id: <3784CF83.D1B311F5@home.com>

[posted & mailed]

Mark Mykkanen wrote:
> 
> Why doesn't the maximum in this program work correctly?  The minimum value 
> works fine but it also matches numbers over 11 digits.

That's because a number with more than 11 digits always contains 11
digits. 

>   print $value,"\n" if $value =~ /\d{7,11}/;

    $value =~ /^\d{7,11}$/;

perldoc perlre

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Thu, 8 Jul 1999 21:18:18 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Min/Max Problem
Message-Id: <7m3m9q$gnq5@news.cyber.net.pk>

> Why doesn't the maximum in this program work correctly?  The minimum value
works fine but it
>  also matches numbers over 11 digits.
>
> open(INPUT,"sample");

use 'or' part.

> while(chomp($value = <INPUT>))
> {
>   print $value,"\n" if $value =~ /\d{7,11}/;
> }

/\d{7,11}/ change to /^\d{7,11}$/

Because it matches 7 through 11 numbers, and if its over 11,
they perl is satisfied because of 7,11....





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

Date: Thu, 08 Jul 1999 18:25:37 +0200
From: Christoph Wernli <cw@dwc.ch>
Subject: Re: Min/Max Problem
Message-Id: <3784D101.36CBBC24@dwc.ch>

Christoph Wernli wrote:
> 
> Mark Mykkanen wrote:
> >
> > Why doesn't the maximum in this program work correctly?  The minimum value works fine but it
> >  also matches numbers over 11 digits.
> 
> That's correct, since you're asking your regex to match any string with seven to eleven
> digits - longer strings obviously contain something between 7 - 11 digits :)
> 
> Try /^\d{7,11}/ instead.

Oops, typo: /^\d{7,11}$/

> -w
> 
> P.S: I hope you're usually testing the filehandle after opening it, right ?
> 
> > open(INPUT,"sample");
> > while(chomp($value = <INPUT>))
> > {
> >   print $value,"\n" if $value =~ /\d{7,11}/;
> > }
> >
> > exit;
> >
> > sample
> > ---BEGIN---
> > 45621
> > 4392155
> > 54567
> > 5465132
> > 545
> > 545
> > dlkja
> > 7
> > 9879067012626165675672157652875387156876532173276876876329868676328763278643256532976871263876876
> > 65465487877
> > 54545655329902
> > 5454565532
> > 6666666666
> > 7777777774
> > 456
> > 25247
> > 6365531
> > kjdsjhh
> > ---END---


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

Date: Thu, 08 Jul 1999 18:24:36 +0200
From: Christoph Wernli <cw@dwc.ch>
Subject: Re: Min/Max Problem
Message-Id: <3784D0C4.A682DE8@dwc.ch>

Mark Mykkanen wrote:
> 
> Why doesn't the maximum in this program work correctly?  The minimum value works fine but it
>  also matches numbers over 11 digits.

That's correct, since you're asking your regex to match any string with seven to eleven
digits - longer strings obviously contain something between 7 - 11 digits :)

Try /^\d{7,11}/ instead.

-w

P.S: I hope you're usually testing the filehandle after opening it, right ?

> open(INPUT,"sample");
> while(chomp($value = <INPUT>))
> {
>   print $value,"\n" if $value =~ /\d{7,11}/;
> }
> 
> exit;
> 
> sample
> ---BEGIN---
> 45621
> 4392155
> 54567
> 5465132
> 545
> 545
> dlkja
> 7
> 9879067012626165675672157652875387156876532173276876876329868676328763278643256532976871263876876
> 65465487877
> 54545655329902
> 5454565532
> 6666666666
> 7777777774
> 456
> 25247
> 6365531
> kjdsjhh
> ---END---


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

Date: Thu, 08 Jul 1999 15:17:41 GMT
From: dafydd1@my-deja.com
Subject: Need Expert Help!
Message-Id: <7m2fe8$e04$1@nnrp1.deja.com>

Hi,

As a perl non-expert, I've got a couple of whinging little problems I
desperately want to solve.

Firstly, I think I must be misunderstanding arrays a bit. I'm trying to
store a filehandle within an array element and getting different
behaviour to storing it in a simple variable, see code...

This ok...

$fh = new FileHandle "> file";
if (defined $fh)
{
   print $fh "test\n";
   $fh->close;
}

This not...

$fh[1] = new FileHandle "> file";
if (defined $fh[1])
{
   print $fh[1] "test\n";
   $fh[1]->close;
}

Am I missing something obvious about how arrays work?

Secondly, how does one split a line by fields when a field can contain
a '\' escaped version of the separator? I'm not sure that something like
this would work without removing the '\' escaped characters?

split /[^\\](\\\\)*\t/ $line;

Any help anyone could give would be.... well.... helpful.

Thanks,

Dafydd


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Thu, 08 Jul 1999 18:04:56 +0100
From: Martin Quensel <martin@adoma.se>
Subject: Re: Need Expert Help!
Message-Id: <3784DA38.13961235@adoma.se>



dafydd1@my-deja.com wrote:
[snip] 
> $fh = new FileHandle "> file";
> if (defined $fh)
> {
>    print $fh "test\n";
>    $fh->close;
 
Just a question...
Why do you need to store filehandles in arrays?

Im sorry, i might be stupid, but i cant see the point in that...
why not just open(NONSTDOUT, ">$file") or die; ? instead of open($fh,
">file") or die;

Do you intend to open 100 files at the same time, and then have your
"filehandlearray" print to them?

Martin Quensel


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

Date: Thu, 08 Jul 1999 16:39:18 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Need Expert Help!
Message-Id: <3784D401.3206097B@home.com>

[posted & mailed]

dafydd1@my-deja.com wrote:
> 
> This not...
> 
> $fh[1] = new FileHandle "> file";
> if (defined $fh[1])
> {
>    print $fh[1] "test\n";
>    $fh[1]->close;
> }
> 
> Am I missing something obvious about how arrays work?

No, you're missing something about the indirect object syntax of the
print function.  From the 'print' entry of perlfunc:

    Note that if you're storing FILEHANDLES in an array or other 
    expression, you will have to use a block returning its value 
    instead: 

        print { $files[$i] } "stuff\n";


perldoc -f print

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Thu, 08 Jul 1999 17:47:10 +0100
From: Dafydd Hopkin <dafydd@gointernet.co.uk>
Subject: Re: Need Expert Help!
Message-Id: <3784D60E.D152EBC7@gointernet.co.uk>

Martin Quensel wrote:
> 
> dafydd1@my-deja.com wrote:
> [snip]
> > $fh = new FileHandle "> file";
> > if (defined $fh)
> > {
> >    print $fh "test\n";
> >    $fh->close;
> 
> Just a question...
> Why do you need to store filehandles in arrays?
> 
> Im sorry, i might be stupid, but i cant see the point in that...
> why not just open(NONSTDOUT, ">$file") or die; ? instead of open($fh,
> ">file") or die;
> 
> Do you intend to open 100 files at the same time, and then have your
> "filehandlearray" print to them?
> 
> Martin Quensel

Something like that yes - I want to write a script which will open a
differing number of files dependent on the number of command line
arguments, and rather than writing separate code for each of the
possible files that could be opened. I want to reference each as an
element of an array, so I can step through the list one by one and do
similar operations on each of them.

-- 
Many thanks,

Dafydd


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

Date: Thu, 08 Jul 1999 16:52:56 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Need Expert Help!
Message-Id: <3784D735.97556E1E@home.com>

[posted & mailed]

It would have been a good idea to split these two questions up into
separate posts.  They you would have been able to use a subject relevant
to each instead of the meaningless one you did use.

dafydd1@my-deja.com wrote:
> 
> Secondly, how does one split a line by fields when a field can contain
> a '\' escaped version of the separator? I'm not sure that something like
> this would work without removing the '\' escaped characters?

Well, try it out and see then.
 
> split /[^\\](\\\\)*\t/ $line;

To split on tabs unless they are escaped:

    split /(?<!\\)\t/, $line; 

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Thu, 08 Jul 1999 16:08:41 GMT
From: "Giovanni Davila" <gio98dr@yahoo.com>
Subject: Need help with Win32::ODBC
Message-Id: <d24h3.6088$w4.90003@news1.frmt1.sfba.home.com>

I have this script:
# -----------------------------------
use Win32::ODBC;
$db = new Win32::ODBC( "myDSN" );
if (!$db->Sql("SELECT * FROM Domains"))
{
 while ($db->FetchRow())
 {
  my (%Data) = $db->DataHash();
  $cuenta++;
  print "$cuenta) $Data{DomainName} $Data{NetBiosName}\n";
 }
}
$db->Close();
# -----------------------------------

I'm getting this error: Can't call method "Sql" on an undefined value
I also get the error with "Close()". It's like it doesn't know that I'm
using Win32::ODBC, which I do have.

Please help!




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

Date: Thu, 08 Jul 1999 16:27:35 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Need help with Win32::ODBC
Message-Id: <3784D144.A817D52B@home.com>

[posted & mailed]

Giovanni Davila wrote:
> 
> I have this script:
> # -----------------------------------
> use Win32::ODBC;
> $db = new Win32::ODBC( "myDSN" );
> if (!$db->Sql("SELECT * FROM Domains"))

[snip]
 
> I'm getting this error: Can't call method "Sql" on an undefined value
> I also get the error with "Close()". It's like it doesn't know that I'm
> using Win32::ODBC, which I do have.

No, you'd be getting a different error if it was like that.  It's more
like the creation of the object failed and returned an undefined value. 
You really should test for this.

    my $db = new Win32::ODBC( "myDSN" ) 
        or die "Failed to create Win32::ODBC object: $!";

I don't know if $! is set when this fails or not.  You'd have to check
the Win32::ODBC documentation for that.  To find out what errors mean in
general, you should search the perldiag section of your Perl
documentation.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Thu, 8 Jul 1999 09:50:16 -0700
From: "Dodger" <dodger@dodger.org>
Subject: Re: newbie help... should be simple
Message-Id: <7m2jd5$ov3$1@ancalagon.dragon-net.net>

Faisal Nasim wrote in message <7ljnih$7ek12@news.cyber.net.pk>...
>> require 'cgi-lib.pl';
>> &ReadParse(*input);
>> print 'Content-type: text/html\n\nThe Number Is '.$input{'blanumber'};
>
>\n\n won't be converted to newlines inside single quotes!



typo. My bad.

Dodger




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

Date: Thu, 08 Jul 1999 20:15:18 +0400
From: Victor Gamov <vit@lipetsk.ru>
Subject: newbie question
Message-Id: <3784CE96.28C10685@lipetsk.ru>


	Hi!

	I'm newbie in perl, so now I have question to everything known All !

	sub sub1 {

		@args = ("a1", "a2", "a3");
		$hash1{'args'} = \@args;
	}

	sub sub2 {

		@args = $hash{'args'};
		foreach $a (@args) {
			print "a=$a, ";		# here I want to see a1, a2, a3
		}
	}

	Where I was wrong?

--
	CU, Victor Gamov


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

Date: Thu, 8 Jul 1999 21:27:25 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: newbie question
Message-Id: <7m3mqr$h2e1@news.cyber.net.pk>

> sub sub1 {
>
> @args = ("a1", "a2", "a3");
> $hash1{'args'} = \@args;
> }
>
> sub sub2 {
>
> @args = $hash{'args'};
> foreach $a (@args) {
> print "a=$a, "; # here I want to see a1, a2, a3
> }
> }

$hash and $hash1 are not same

Moreover,

@args = $hash { 'args' }

should be

@args = @ { $hash { 'args' } };




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

Date: Thu, 08 Jul 1999 11:39:09 -0500
From: Tom Turton <tturton@ntx.waymark.net>
Subject: Re: newbie question
Message-Id: <3784D42D.8B00722@ntx.waymark.net>



Victor Gamov wrote:
> 
>         Hi!
> 
>         I'm newbie in perl, so now I have question to everything known All !
> 
>         sub sub1 { 
>                 @args = ("a1", "a2", "a3");
>                 $hash1{'args'} = \@args;
>         }
> 
>         sub sub2 {
> #                @args = $hash{'args'};   replace this with next line...
>                 @args = @{$hash1{'args'}};
>                 foreach $a (@args) {
>                         print "a=$a, ";         # here I want to see a1, a2, a3
>                 }
>         }


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

Date: Thu, 08 Jul 1999 18:28:19 +0200
From: Per Kistler <kistler@fnmail.com>
To: Victor Gamov <vit@lipetsk.ru>
Subject: Re: newbie question
Message-Id: <3784D1A3.B020E88F@fnmail.com>

Hi Victor

Victor Gamov wrote:

>                 @args = $hash{'args'};
@args= @{$hash{'args'}};
because it was a reference...

>         Where I was wrong?
>         CU, Victor Gamov

-- 
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------


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

Date: Thu, 08 Jul 1999 12:43:16 -0400
From: David U <offwhite@tidalwave.net>
Subject: Pattern match counting
Message-Id: <3784D524.FBC19E35@tidalwave.net>

Is there a way to count how many times a pattern has been matched?

I'm trying to see how many times a string contains repetitive bits of
info --

$example_data = "ALLR : ALLR : ALLR : ALLR : USPA : AMCA : ALLR : USMI :
USOH : USIL : USNY : AMCA : USME : USMD : USMD : ALLR : USMD : USMD :
ALLR : USMD : USLA : ALLR : AUST : USAZ : ALLR : USKY : USKY : USNJ :
USCA : USCA : USCA : ALLR : ALLR : USME : ALLR : USCA : ALLR : USNJ :
USNJ : USCA : USWI : ALLR : AMCA : ALLR";

How can I count the number of times "ALLR" appears in the $example_data?

I'm guessing it'll look something like --

$count_results =~ (/ALLR/, $example_data);

 ...but I that doesn't seem to work, of course,  when I try to print
$count_results.

Thanks!




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

Date: Thu, 08 Jul 1999 16:58:44 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: Perl Everywhere : That's what I want
Message-Id: <3784d601.386684536@news.nikoma.de>

The Perl filesystem is at http://www.assurdo.com/perlfs/

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


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

Date: Thu, 8 Jul 1999 11:09:47 -0500
From: "Paul Glidden" <paul.glidden@unisys.com>
Subject: Perl Installation errors on Solaris 2.5 system
Message-Id: <7m2igb$bu2$1@bbnews1.unisys.com>

While trying to configure perl using the -des extensions I got this error:


Finding dependencies for malloc.o.
In file included from perl.h:223,
                 from
malloc.c:6:/opt/gnu/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/include/sys/param
 .h:187: warning
: `NBBY' redefined
/usr/include/sys/select.h:45: warning: this is the location of the previous
definition
In file included from /usr/include/sys/stream.h:26,
                 from /usr/include/netinet/in.h:38,
                 from perl.h:361,
                 from malloc.c:6:
/usr/include/sys/model.h:32: #error "No DATAMODEL_NATIVE specified"

I received a similar error for every depency that configure tried to find
from this point on.  I can not find any information regarding this set of
errors and currently have no clue on a place to search for answers.

Any help would be appreciated

thanks
Paul Glidden




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

Date: Thu, 08 Jul 1999 15:40:02 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Problem with a SQL statement in a Perl script
Message-Id: <3784B842.F51C018B@hotmail.com>

> > I found out that afte my execute statement i forgot to add a
> $dbh->prepare('COMMIT');
> statement.

Oops, 
I only did that once!! but it took a while to realise :-),
you can use:

my $rc = $dbh->commit;

after youve checked the return from your insert.
or set AutoCommit so you dont have to bother!

Richard H


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

Date: Thu, 08 Jul 1999 16:44:02 GMT
From: sethr@crocker.com
Subject: Re: regex to eat all html tags (or check your faqs, Jack.)
Message-Id: <7m2kge$gcp$1@nnrp1.deja.com>

perldoc -q html. Very cool. Thanks. Seth

In article <ttlaet7faz5.fsf@sphere.cs.man.ac.uk>,
  Graham Gough <graham@cs.man.ac.uk> wrote:
>  perldoc -q html
>
> is even easier than button clicking
>
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 8 Jul 1999 15:43:13 GMT
From: Tom Mornini <tmornini@netcom9.netcom.com>
Subject: Re: REMOTE_HOST never gives host...
Message-Id: <7m2guh$plk@dfw-ixnews3.ix.netcom.com>

Brendan Reville <breville@mpce.mq.edu.au> wrote:

: I use this:

:    $ip_number = "$ENV{'REMOTE_HOST'}";

: to grab a visitor's host name.  Now when I visit other people's websites,
: they can display my actual host name (blah.mq.edu.au) using whatever scripts
: they use.  But my own script, using the above, can only get my IP number.

The web server must be configured to skip DNS lookups, which is a HUGE
performance win for the web server.

Check out:

perldoc -f gethostbyaddr

-- Tom Mornini
-- InfoMania


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

Date: 8 Jul 1999 15:44:58 GMT
From: "Alex" <alex@exbook.com>
Subject: Simple.pm Error
Message-Id: <01bec958$d51cc4d0$258eb987@il0015jtampc>

Hello anyone,

I run a test.pl perl script try to fetch a website, and it 
generates the following error message, do you know
what is wrong with it?

"Undefined subroutine &main::get called at t line 8."

I don't have the LWP library in our server, that is why
I need to create my owns. so I copy the Simple.pm
to my local directory. The file structure looks this...
/home/alex/temp/test.pl
/home/alex/temp/Simple.pm

following is test.pl

#!/usr/exptools/bin/perl
BEGIN{
        push (@INC, "/home/alex/temp");
}

use Simple;

$content = get("http://www.yahoo.com/");

print $content;

Thank you for you help!

Alex


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

Date: Thu, 08 Jul 1999 18:35:02 +0200
From: Per Kistler <kistler@fnmail.com>
To: Alex <alex@exbook.com>
Subject: Re: Simple.pm Error
Message-Id: <3784D336.80325D8C@fnmail.com>

Hi Alex

Simple.pm uses other modules, which you probably do not have.
Either install the modules in your directory, with 
perl -e shell -MCPAN.

Or if it's just for that one case, you may use a commandline
tool, like wget or url_get which load a page into a file
and then read that file. There are many ways to get at
a www page. It's an easy protocol.

Regards, Per.

Alex wrote:
> 
> Hello anyone,
> 
> I run a test.pl perl script try to fetch a website, and it
> generates the following error message, do you know
> what is wrong with it?
> 
> "Undefined subroutine &main::get called at t line 8."
> 
> I don't have the LWP library in our server, that is why
> I need to create my owns. so I copy the Simple.pm
> to my local directory. The file structure looks this...
> /home/alex/temp/test.pl
> /home/alex/temp/Simple.pm
> 
> following is test.pl
> 
> #!/usr/exptools/bin/perl
> BEGIN{
>         push (@INC, "/home/alex/temp");
> }
> 
> use Simple;
> 
> $content = get("http://www.yahoo.com/");
> 
> print $content;
> 
> Thank you for you help!
> 
> Alex

-- 
Per Kistler kistler@fnmail.com / kistler@gmx.net
------------------------------------------------------------


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

Date: Thu, 8 Jul 1999 11:24:55 -0400
From: "Ken Hirsch" <kenhirsch@myself.com>
Subject: Re: throw me a bone here!........please
Message-Id: <7m2fle$af2$1@ash.prod.itd.earthlink.net>

> hi there cant figure out what is wrong
>
> i did the -w command and this is what i got
> possible typo:"LOCK_FILE" at bnbform.cgi line 306
>
>  304.     # Do Nothing
> 305.    }
> 306.    open(LOCK_FILE, ">$lockfile");

You need to test to see if this succeeds.

> 307. }
> 308.
> 309. sub drop_the_lock
> 310. {
> 311.   close($lockfile);
> 312.   unlink($lockfile);

Here you should be using close(LOCK_FILE);
However, as another respondent indicated, this code may not do what you
want.

>
> possible typo:"i" at bnbform.cgi line 115

This means you are only using the variable $i once.

It is best to always use '-w' and 'use strict' and declare your variables.

You might save yourself some effort by using the CGI.pm module.

Ken Hirsch






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

Date: Thu, 8 Jul 1999 09:59:03 -0700
From: "Dodger" <dodger@dodger.org>
Subject: totally lost on an error message
Message-Id: <7m2jto$p2u$1@ancalagon.dragon-net.net>

Okay, this is a rarity... I don't usually post 'totally lost' type stuff,
but I'm totally lost.

I went and installed Image::Magick because I thought it would be pretty cool
to have a banner that showed who was in my chatroom. Not a bad idea, is it?

So I installed it and it Made and everything just fine and I went to write a
script and *barflarg* nothing.

So, having been tech support too many times to count, i go ahead and
troubleshoot by stripping things down to the lowest common denominator.
Here's the script:

#!/usr/bin/perl
use Image::Magick;
print "Using Magick\n";
$image = Image::Magick->new;
print "Have a new image\n";
exit;

here's the results:

dragon-lord html/magick> !p
perl test.pl
Using Magick
Have a new image
perl: can't resolve symbol 'FormatString'
dragon-lord html/magick>

Cannot find this error message or anything that even, to me, looks like it
in anything. No clue what this error means. No idea what is or isn't going
on here. It just cannot make the object. Dead in the water. Me, totally lost
and frustrated, because the line to make the object is right out of an
O'Reilly book and essentially identical to a line in the docs for
ImageMagick.


Dodger (who suspects that's some kind of C error message that decided to
sneak into Perl to be mean to me)




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

Date: Thu, 08 Jul 1999 11:20:51 -0400
From: toby <toby@venice.cas.utk.edu>
Subject: Re: Which is better, Perl, Cold Fusion or...
Message-Id: <3784C1D3.5C287A70@venice.cas.utk.edu>



Andrew Singer wrote:

> >Hey, I'm a Yalie interning for Trade Show News Network (www.tsnn.com).
>

Flame. Flame mercilessly.

>We
>have to decide which language to program in to connect our database to the
>web and make dynamic web pages, etc.  Would you recommend, Perl, Cold
>Fusion, or some other language, like Zope or PHP?  We are not looking for
>the cheapest or easiest to use language; we want the most powerful and
>reliable.  Thanks a lot for your help!

Seriously, what sort of database? You need to give more <mr.
burns>details</mr. burns>.

Toby



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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V9 Issue 78
************************************


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