[17223] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4645 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 17 18:10:46 2000

Date: Tue, 17 Oct 2000 15:10:20 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <971820620-v9-i4645@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 17 Oct 2000     Volume: 9 Number: 4645

Today's topics:
    Re: Make this regex neater, anyone? (Craig Berry)
    Re: Maximum file size? <berube@odyssee.net>
    Re: Maximum file size? <jeff@vpservices.com>
        Microsoft Exchange Server <skpurcell@hotmail.com>
    Re: Net::DNS host info <peter.sundstrom@eds.com>
    Re: new perl can not fine libperl.sl lopez@abqato.abq.sc.philips.com
    Re: Parsing binary files <lr@hpl.hp.com>
    Re: Perl under win2000 <spambait@amigo.net>
    Re: Perl works but not PerlScript - Need Help <mjamesj@pacbell.nopr0nads.net>
        Perl: Day One, a Stupid Question frannyzoo@hotmail.com
    Re: Perl: Day One, a Stupid Question michaeljgardner@my-deja.com
    Re: Perl: Day One, a Stupid Question <jeff@vpservices.com>
        PGP Module Question <t0873@my-deja.com>
        question about shift ivolla@my-deja.com
    Re: question about shift <wernerwolfgang@t-online.de>
    Re: question about shift (Clay Irving)
    Re: question about shift <jeff@vpservices.com>
    Re: question about shift pickup22@my-deja.com
    Re: question about shift ivolla@my-deja.com
    Re: question <james@NOSPAM.demon.co.uk>
    Re: Regular Expression problem <uri@sysarch.com>
    Re: Save As... Popup box <rob@robdon.com>
    Re: strange behaviour regular expression <mjcarman@home.com>
    Re: strange behaviour regular expression <lr@hpl.hp.com>
        write to fil <tony.dalbrekt@swipnet.se>
    Re: write to fil <stephenk@cc.gatech.edu>
    Re: write to fil <jeffp@crusoe.net>
    Re: write to fil <james@NOSPAM.demon.co.uk>
    Re: write to fil <james@NOSPAM.demon.co.uk>
    Re: write to fil <lr@hpl.hp.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 17 Oct 2000 20:52:08 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Make this regex neater, anyone?
Message-Id: <supevobbhsri38@corp.supernews.com>

Philip Lees (pjlees@ics.forthcomingevents.gr) wrote:
: Hi. I have strings of the form
: 
: IDT1PAT1ADM12ECG5
: 
: and I need to extract the _last_ group of letters - ECG in the above
: example. The regex also needs to handle the simplest case, i.e. IDT4
: gives IDT.

  $lastNonDigits = ($str =~ m/\D+/g)[-1];

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Quidquid latine dictum sit, altum viditur."
   |


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

Date: Tue, 17 Oct 2000 15:55:55 -0400
From: "Neb" <berube@odyssee.net>
Subject: Re: Maximum file size?
Message-Id: <d62H5.209$a8.8827@news.globetrotter.net>


Jeff Zucker <jeff@vpservices.com> a écrit dans le message :
39EC854D.460315C6@vpservices.com...
> Rafael Garcia-Suarez wrote:
> >
> > Neb wrote in comp.lang.perl.misc:
> > >Hi,
> > >
> > >I have a web site where I store all my members in a flat file (no DB).
> > >Everytime a new user become a member, I add his information in the file
by
> > >reading all the file content in memory, make sure he doesn't exist yet,
and
> > >then store all content back on disk.  When the user logs in, I read all
file
> > >in memory, and make sure he is a real member.  So far, the file size is
of
> > >90 KB and the time to read in memory and write on disk the file content
is
> > >fast.
> > >
> > >My question: is there a maximum size where I will start to see some
problems
> > >using this method?  Is 1 Meg file size start to be a problem ?
> >
> > This is not a good idea to store such data in files. 90 kB is large
> > enough and you should upgrade now to a DB.
>
> There are other reasons to move from flat files to a full database, but
> speed, on a 90 kb  file is not one of them.  DBD::RAM and DBD::CSV can
> select through a 10,000 record flat file of 2.5 megabytes at a rate of
> about 1 second per megabyte.  In the time it would take them to parse a
> 90 kb file, you probably couldn't even make a connection to a real
> database.
>
> --
> Jeff

Is there some where I can get more examples about these DBD::RAM and
DBD::CSV?

neb





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

Date: Tue, 17 Oct 2000 14:05:17 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Maximum file size?
Message-Id: <39ECBF0D.98090010@vpservices.com>

Neb wrote:
> 
> Jeff Zucker <jeff@vpservices.com> a écrit dans le message :
> 39EC854D.460315C6@vpservices.com...
> > >
> > > Neb wrote in comp.lang.perl.misc:
> > > >Hi,
> > > >
> > > >I have a web site where I store all my members in a flat file (no DB).
> >
> > There are other reasons to move from flat files to a full database, but
> > speed, on a 90 kb  file is not one of them.  DBD::RAM and DBD::CSV can
> > select through a 10,000 record flat file of 2.5 megabytes at a rate of
> > about 1 second per megabyte.  In the time it would take them to parse a
> > 90 kb file, you probably couldn't even make a connection to a real
> > database.
> 
> Is there some where I can get more examples about these DBD::RAM and
> DBD::CSV?

Both modules come with documentation and examples.  Both use standard
DBI methods so most of the examples in the tutorials and books about DBI
are also relevant, see, for example:

	http://www.symbolstone.org/technology/perl/DBI/

Both modules will handle comma separated values files including any
kinds of "delimiters" (pipes, tabs, whatever) and additionally DBD::RAM
will handle fixed width records, XML files, and other formats and can
work either in memory or using files.

This example creates a database table; inserts, updates, and deletes
records in it, retrieves and prints the records, and then destroys the
table:

#!/usr/local/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect('dbi:RAM:',,,{RaiseError=>1})
          or die $DBI::errstr;
my $table = 'testTable';
$dbh->do("CREATE TABLE $table ( idCol INTEGER, testCol TEXT )");
$dbh->do("INSERT INTO $table VALUES (1,'Frosh')");
$dbh->do("INSERT INTO $table VALUES (2,'Fribble')");
$dbh->do("DELETE FROM $table WHERE idCol = 1");
$dbh->do(qq/
    UPDATE $table
       SET testCol = 'Hello new world!'
     WHERE idCol = 2
/);
my $sth = $dbh->prepare(qq/SELECT * FROM $table/);
$sth->execute;
while (my $row = $sth->fetch) {
    print "[$_] " for @$row;
    print "\n";
}
$dbh->do("DROP TABLE $table");
__END__


-- 
Jeff


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

Date: Tue, 17 Oct 2000 15:50:16 -0500
From: "spurcell" <skpurcell@hotmail.com>
Subject: Microsoft Exchange Server
Message-Id: <39ecbb9f$0$14448@wodc7nh7.news.uu.net>

Hello,
I was wondering if it is possible to update a Microsoft Exchange Server
(Update e-mail addresses, and other information) via a perl script?

I have seen a lot of modules up at cpan, but don't quite know what I should
be looking for. Also, I am a Unix guy, and do not know much about COM
objects, and the alike that Microsoft peddles.

If anyone has any information to get me started I would appreciate hearing
from you.

Sincerely
Scott




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

Date: Wed, 18 Oct 2000 10:56:44 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Net::DNS host info
Message-Id: <8sii5n$nmo$1@hermes.nz.eds.com>


Michael Fuhr <mfuhr@dimensional.com> wrote in message
news:8shs5t$gqo@flatland.dimensional.com...
> "Peter Sundstrom" <peter.sundstrom@eds.com> writes:
>
> > I'm using Net::DNS to list a zone and I want to return the data without
the
> > SOA TTL field.
>
> Actually, each record has its own TTL.  In older versions of BIND, the
> "minimum" field in the SOA record was used as a default if the TTL
> wasn't specified.  In newer versions of BIND, the $TTL statement in the
> zone file sets the default (see RFC 2308).
>
> > The code snippet I'm using is:
> >
> > foreach my $rr (@zone) {
> >         next if ($rr->type !~ /\bA|CNAME\b/);
> >
> >         my $name = $rr->name;
> >         my $class = $rr->class;
> >         my $type = $rr->type;
> >
> >         if ($rr->type eq 'CNAME') {
> >                 $data=$rr->cname;
> >         }
> >         elsif ($rr->type eq 'MX') {
> >                 $data=$rr->mx;
> >         }
> >         else {
> >                 $data=$rr->address;
> >         }
> >
> >         push(@hosts,"$name $class $type $data\n");
> > }
> >
> > return @hosts;
> >
> > This seems like a lot of overkill to do what I want to achieve.  The
other
> > way I though of doing it was:
> >
> > foreach my $rr (@zone) {
> >     next if ($rr->type !~ /\bA|CNAME\b/);
> >
> >     my @data=split(' ',$rr->string);
> >      push(@hosts,"$data[0] $data[2] $data[3] $data[4]\n");
> > }
> >
> > return @hosts;
> >
> > That still seems a little messy.  Suggestions for better ways to do it?
>
> The $rr->rdatastr method returns a string representation of the record
> data, so you don't need to check each record type.  See if this does
> what you want:
>
> foreach my $rr (@zone) {
>     next unless $rr->type =~ /^(A|CNAME)$/;
>     push (@hosts, join(" ", $rr->name, $rr->class, $rr->type,
$rr->rdatastr) . "\n");
> }
>


Thanks Michael.  That works exactly how I want it.




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

Date: 17 Oct 2000 11:53:01 -0600
From: lopez@abqato.abq.sc.philips.com
Subject: Re: new perl can not fine libperl.sl
Message-Id: <jc6zok3z75u.fsf@abqato.abq.sc.philips.com>

lopez@abqato.abq.sc.philips.com writes:

> lopez@abqato.abq.sc.philips.com writes:
> I now see the answer to one of my questions:
> > I just built an instance of perl last night on a HPUX server.
> > This is from the build log:
> > gnu_sahphpd2[31]% perl -V
> > Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
> >   Platform:
> >     osname=hpux, osvers=11.00, archname=PA-RISC2.0
> >     uname='hp-ux sahphpd2 b.11.00 u 9000800 688319363 unlimited-user license '
> >     hint=recommended, useposix=true, d_sigaction=define
> >     usethreads=undef useperlio=undef d_sfio=undef
> >   Compiler:
> >     cc='gcc', optimize='-O', gccversion=2.95.2 19991024 (release)
> >     cppflags='-D_HPUX_SOURCE -I/usr/local/include'
> >     ccflags ='-D_HPUX_SOURCE -I/usr/local/include'
> >     stdchar='unsigned char', d_stdstdio=define, usevfork=false
> >     intsize=4, longsize=4, ptrsize=4, doublesize=8
> >     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
> >     alignbytes=8, usemymalloc=y, prototype=define
> >   Linker and Libraries:
> >     ld='ld', ldflags =' -L/usr/local/lib'
> >     libpth=/usr/local/lib /lib/pa1.1 /lib /usr/lib /usr/ccs/lib
> >     libs=-lnsl -lnm -lndbm -ldld -lm -lc -lndir -lcrypt
> >     libc=, so=sl, useshrplib=true, libperl=libperl.sl
> >   Dynamic Linking:
> >     dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred '
> >     cccdlflags='-fpic', lddlflags='-b -L/usr/local/lib'
> > 
> > 
> > Characteristics of this binary (from libperl): 
> >   Built under hpux
> >   Compiled at Oct 16 2000 19:15:24
> >   @INC:
> >     /usr/local/lib/perl5/5.00503/PA-RISC2.0
> >     /usr/local/lib/perl5/5.00503
> >     /usr/local/lib/perl5/site_perl/5.005/PA-RISC2.0
> >     /usr/local/lib/perl5/site_perl/5.005
> >     .
> > 
> > Now I came in this morning and this is what is happening:
> > gnu_sahphpd2[40]% perl -V
> > /usr/lib/dld.sl: Can't open shared library: /usr/local/build/perl-5.005.03/libperl.sl
> > /usr/lib/dld.sl: No such file or directory
> > IOT trap (core dumped)
> > 
> > The libperl.sl is really at
> > /usr/local/lib/perl5/5.00503/PA-RISC2.0/CORE/libperl.sl
> > where I think it should be.
> > 
> > I do not understand
> > 1) Why the perl is asking dld.sl to look for /usr/local/build/perl-5.005.03/libperl.sl
> >    which was part of only the build tree which I would think can be now removed.
> > 2) Why the libperl.sl file is no longer in the build tree. I never did a make clean
> >    and the build log never shows any remove which could account for the disappearance.
> 
> This is because I renamed the directory in /usr/local/build from
> perl-5.005.03 to built-perl-5.005.03 which is a practive I have which
> normally helps me instead of causing me problems. So, the only
> remaining question is why isn't the
> /usr/local/lib/perl5/5.00503/PA-RISC2.0/CORE/libperl.sl
> file being referenced?

If I read the Changes files correctly, it looks like perl, despite
shrpdir = /usr/local/lib/perl5/5.00503/PA-RISC2.0/CORE, will now
only look in the build directory tree. Meaning that it has to be
kept around with a consequence of a lot of wasted disk space. Is 
this correct? or is there a way to force the use of the 
/usr/local/lib/perl5/5.00503/PA-RISC2.0/CORE/libperl.sl?
Why put it there if it is not going to be used?

> 
> > 
> > Thanks in advance for suggestions on how to fix this.
> > -- 
> > Robert.Lopez@Philips.com
> > Assembly and Test Organization,  Philips Semiconductors
> > Mail Stop 20,   9201 Pan American Fwy. N.E.,
> > Albuquerque, New Mexico 87113 USA  [P: (505)822-7112  F: x7237]
> 
> -- 
> Robert.Lopez@Philips.com
> Assembly and Test Organization,  Philips Semiconductors
> Mail Stop 20,   9201 Pan American Fwy. N.E.,
> Albuquerque, New Mexico 87113 USA  [P: (505)822-7112  F: x7237]

-- 
Robert.Lopez@Philips.com
Assembly and Test Organization,  Philips Semiconductors
Mail Stop 20,   9201 Pan American Fwy. N.E.,
Albuquerque, New Mexico 87113 USA  [P: (505)822-7112  F: x7237]


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

Date: Tue, 17 Oct 2000 11:08:50 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Parsing binary files
Message-Id: <MPG.1456358af11edac898ae3b@nntp.hpl.hp.com>

In article <8si0dj$t6v$1@nnrp1.deja.com> on Tue, 17 Oct 2000 16:57:28 
GMT, Ajai Khattri <ajai@netscape.net> says...
> In article <8sg79i$a8r$1@riva.ucam.org>,
>   cjw44@flatline.org.uk (Colin Watson) wrote:
> 
> > Set the input record separator variable $/ to "\n\n\001\001".
> 
> Yes that works. I was initially reading the file as binary data (binmode
> and read) and trying to search through it - this is much simpler (which
> is how it should be in PERL! ;-) I also was using \000 instead of \001
> for ^A - I should know better!

I was surprised that everyone suggested using "\001" for control-A 
(including the superfluous zeros), but no one suggested the more obvious 
(and clearly more mnemonic) "\cA".

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 17 Oct 2000 14:30:56 -0600
From: PerlStalker <spambait@amigo.net>
Subject: Re: Perl under win2000
Message-Id: <39ECB700.6030205@amigo.net>

Squeek wrote:

> Hya,
> 
> I`m fairly new to Perl and would like it to install and run it on my Windows
> 2000 running IIS.
> I already installed Perl but I need to know where to put the CGI-BIN to
> store my script in a
> way that they can be used locally.

You can put the cgi-bin any where you want (under the document root of 
your web site). You don't even have to call it cgi-bin. You need to 
allow scripting on that directory so that the web server can run the 
scripts.

As far as other Perl programs (non-cgi stuff that you'll write to make 
your life easier (or at least more fun)), they can be where ever you want.

PerlStalker



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

Date: Tue, 17 Oct 2000 12:35:38 -0700
From: mike <mjamesj@pacbell.nopr0nads.net>
Subject: Re: Perl works but not PerlScript - Need Help
Message-Id: <gu9pus8ksheibcj980u7ecri3ftrsau1n7@4ax.com>

What happens when you try and run the first example? I tried it on my
machine and it worked fine just double clicking on it on my desktop
with Apache not running. It also worked when I put it in the htdocs
directory and started Apache and loaded it like a normal page.
I guess check your perl/bin directory for PerlSE.dll which is the
Perlscript scripting engine. 
I'm using NT4 and IE5.01 so maybe that makes a difference.
Good Luck
mike


On Tue, 17 Oct 2000 03:56:36 -0500, "BW" <bwats@ticnet.com> wrote:

>I'm using Apache 1.3.14/Win95/ActivePerl
>The setup for Apache went ok, and Perl works fine with CGI scripts.
>But PerlScript doesn't work.
>The Docs say that it's an option during the install, But I didn't see any
>options for PerlScript.
>Of course the docs didn't tell any method to invoke the option.
>???
>Anyone know the secret to this option?
>
>Here's what the Docs say:
>
>Requirements: (These are met)
>Windows 95
>
>Microsoft Windows Installer 1.1+ (available from
>http://download.microsoft.com/download/platformsdk/wininst/1.1/W9X/EN-US/Ins
>tMsi.exe)
>Internet Explorer 5 (available from http://windowsupdate.microsoft.com)
>DCOM for Windows 95 (available from
>http://www.microsoft.com/com/resources/downloads.asp)
>MSVCRT (available from ftp://ftp.microsoft.com/softlib/mslfiles/msvcrt.exe
>
>From the ActivePerl Docs:
>==========================================
>Windows Specifics:
>What do I need to run PerlScript?
>ActivePerl
>an ActiveX scripting host (see above)
>Perl scripts!
>----------------------------------------------------------------------------
>----
>How do I install PerlScript?
>When you launch the ActivePerl installer, PerlScript is one of the
>components you can optionally install. You must install, or have previously
>installed, ActivePerl to use PerlScript.
>==========================================
>
>OK, all this is cool, my Paths are set, permissions are set for my cgi-bin
>directory.
>Examples from the ActiveState distribution:
>==========================
>This doesn't work:
>
><HTML>
><HEAD>
><TITLE>PerlScript Hello World!</TITLE>
></HEAD>
><BODY BGCOLOR="#FFFFFF">
><H1>PerlScript Hello world! (See Below)</H1>
><SCRIPT LANGUAGE="PerlScript">
>$window->document->write('Hello world!');
></SCRIPT>
></BODY>
></HTML>
>============================
>This works:
>
>#!C:/perl/bin/perl
>
>use CGI ':standard';
>
>print header;
>print start_html('A Simple Example'),
>    h1('A Simple Example'),
>    start_form,
>    "What's your name? ",textfield('name'),
>    p,
>    "What's the combination?",
>    p,
>    checkbox_group(-name=>'words',
>     -values=>['eenie','meenie','minie','moe'],
>     -defaults=>['eenie','minie']),
>    p,
>    "What's your favorite color? ",
>    popup_menu(-name=>'color',
>        -values=>['red','green','blue','chartreuse']),
>    p,
>    submit,
>    end_form,
>    hr;
>
>if (param()) {
>    print
> "Your name is: ",em(param('name')),
> p,
> "The keywords are: ",em(join(", ",param('words'))),
> p,
> "Your favorite color is: ",em(param('color')),
> hr;
>}
>print a({href=>'../cgi_docs.html'},'Go to the documentation');
>print end_html;
>==========================
>
>Any help would be appreciated =)
>


______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
 With Servers In California, Texas And Virginia - The Worlds Uncensored News Source
  


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

Date: Tue, 17 Oct 2000 19:58:00 GMT
From: frannyzoo@hotmail.com
Subject: Perl: Day One, a Stupid Question
Message-Id: <8sib04$7dq$1@nnrp1.deja.com>

Okay, this is pretty darn stupid, but I'm trying to check whether I
installed perl right on my win98 machine and I'm trying both the
Start-Run command line and a bunch of ms-dos prompt command line and I
can't get either of the two example scripts to run (example.pl and perl
-v) and nothing.  Am I missing something about "command lines" here?  An
 obviously soon to be genius level programmer wants to know.

scot


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 17 Oct 2000 20:19:50 GMT
From: michaeljgardner@my-deja.com
Subject: Re: Perl: Day One, a Stupid Question
Message-Id: <8sic8t$8jk$1@nnrp1.deja.com>

In article <8sib04$7dq$1@nnrp1.deja.com>,
  frannyzoo@hotmail.com wrote:
> Okay, this is pretty darn stupid, but I'm trying to check whether I
> installed perl right on my win98 machine and I'm trying both the
> Start-Run command line and a bunch of ms-dos prompt command line and I
> can't get either of the two example scripts to run (example.pl and
perl
> -v) and nothing.  Am I missing something about "command lines" here?
An
>  obviously soon to be genius level programmer wants to know.
>
> scot
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

Scot,

Does either perl -v or example.pl give you a 'bad command or filename'?
If so you might want to see if your perl\bin directory is in your path
statement.  Also, to run a perl script on my machine, I type in perl
prior to the scriptname.


Michael
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 17 Oct 2000 13:28:56 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Perl: Day One, a Stupid Question
Message-Id: <39ECB688.E2390702@vpservices.com>

frannyzoo@hotmail.com wrote:
> 

The answer is on page 17 of _The Way of the Pilgrim_.  

> Okay, this is pretty darn stupid, but I'm trying to check whether I
> installed perl right on my win98 machine and I'm trying both the
> Start-Run command line and a bunch of ms-dos prompt command line and I
> can't get either of the two example scripts to run (example.pl and perl
> -v) and nothing.  Am I missing something about "command lines" here?  An
>  obviously soon to be genius level programmer wants to know.

What does "can't get them to run" mean?  Is there an error message? 
What is the error message?  PSI::ESP tells me the error message is "Bad
command or file name".  That means you must punish the command, it has
been bad.  No, no, wrong OS, sorry. That actually means that perl is not
on your path.  It probably will be the next time you boot your computer,
but if not, check your manuals on how to set the DOS path.  In the mean
time, try this:

1. Select Start menu - Run
2. Type "command" (without the quotes), press enter
3. Type "c:\perl\bin\perl -v" (without the quotes), press enter

If you installed Perl from activestate (which you should have) and kept
the default directory structure, that should work.  If not, change the
directory path in #3 to whatever you selected as the alternate directory
to install perl in.

-- 
Jeff


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

Date: Tue, 17 Oct 2000 18:57:33 GMT
From: t0873 <t0873@my-deja.com>
Subject: PGP Module Question
Message-Id: <8si7eo$475$1@nnrp1.deja.com>

Hi all,

I want to use PGP module on windows NT. I tried to use this but it is
giving me error while declaring the object. it says "PGP configuration
file not found.". it looking for config file in


  if (! -e "$pgppath/config.txt" &&
      ! -e "/usr/local/lib/pgp/config.txt" )
  {
    carp "PGP configuration file not found.";
    return (0);
  };



what to do in case of Windows NT???
I am using PGP6.0 desktop


Thanks in advance.

+T+


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 17 Oct 2000 18:34:03 GMT
From: ivolla@my-deja.com
Subject: question about shift
Message-Id: <8si62q$308$1@nnrp1.deja.com>

I am new to Perl, and programming for that matter. I have been trying
to figure out what shift does. In this context:

my($newlog) = shift;

what is this assigning to $newlog? The first element of @_? What is
shift doing. When I run this script:

@array = (1..5);
while ($element = shift(@array)) {
	print("$element - ");
}
print ("/n");

I get "1 - 2 - 3 - 4 - 5 - /n"
which totally confuses me. Any help would be very helpfull. Thanks in
advance.



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 17 Oct 2000 21:24:27 +0200
From: Wolfgang Werner <wernerwolfgang@t-online.de>
Subject: Re: question about shift
Message-Id: <39ECA76B.B64E7A13@t-online.de>

shift deletes the "leftmost" value of an array, that means, the one with
the lowest index.
@array = (1..5);
$x  = shift(@array);

$x is now 1, @array is now (2,3,4,5)

ivolla@my-deja.com schrieb:

> I am new to Perl, and programming for that matter. I have been trying
> to figure out what shift does. In this context:
>
> my($newlog) = shift;
>
> what is this assigning to $newlog? The first element of @_? What is
> shift doing. When I run this script:
>
> @array = (1..5);
> while ($element = shift(@array)) {
>         print("$element - ");
> }
> print ("/n");
>
> I get "1 - 2 - 3 - 4 - 5 - /n"
> which totally confuses me. Any help would be very helpfull. Thanks in
> advance.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: 17 Oct 2000 19:38:45 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: question about shift
Message-Id: <slrn8upam5.3ek.clay@panix2.panix.com>

On Tue, 17 Oct 2000 18:34:03 GMT, ivolla@my-deja.com <ivolla@my-deja.com> wrote:

>I am new to Perl, and programming for that matter. I have been trying
>to figure out what shift does. In this context:
>
>my($newlog) = shift;
>
>what is this assigning to $newlog? The first element of @_? What is
>shift doing. 

What does the documentation indicate?

  perldoc -f shift

>When I run this script:
>
>@array = (1..5);
>while ($element = shift(@array)) {
>	print("$element - ");
>}
>print ("/n");
>
>I get "1 - 2 - 3 - 4 - 5 - /n"
>which totally confuses me. Any help would be very helpfull. Thanks in
>advance.

Let's try this:

  #!/usr/bin/perl -w
  
  @array = (1..5);
  
  $value = shift(@array);
  print "$value\n";
  
  $value = shift(@array);
  print "$value\n";
  
  $value = shift(@array);
  print "$value\n";
  
result:

  1
  2
  3

Does this make sense to you?

-- 
Clay Irving <clay@panix.com>
Time Flies like an arrow. Fruit Flies like a banana 
- Groucho Marx


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

Date: Tue, 17 Oct 2000 12:43:59 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: question about shift
Message-Id: <39ECABFF.A61A03B5@vpservices.com>

ivolla@my-deja.com wrote:
> 
> I am new to Perl, and programming for that matter. I have been trying
> to figure out what shift does. 

Go to a command line and type "perldoc -f shift".  That should explain
it all to you.

Shift "shifts" off the first element in an array, that is it takes the
first element in the array and assigns it to whatever variable is being
assigned to the shift, and it leaves the array shorter by that one
element.

> my($newlog) = shift;
> 
> what is this assigning to $newlog? The first element of @_? 

Yes.

> @array = (1..5);
> while ($element = shift(@array)) {
>         print("$element - ");
> }
> print ("/n");
> 
> I get "1 - 2 - 3 - 4 - 5 - /n"

Right, while there are numbers in the array, shift off the first one and
print it, then print a hyphen.  So first it shifts off "1" and prints
it, leaving "2,3,4,5" in the array, then it shifts off the first of
those: '2', prints it, leaving "3,4,5" in the array, etc.

Capeche?

-- 
Jeff


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

Date: Tue, 17 Oct 2000 20:17:51 GMT
From: pickup22@my-deja.com
Subject: Re: question about shift
Message-Id: <8sic56$8i1$1@nnrp1.deja.com>

In article <8si62q$308$1@nnrp1.deja.com>,
  ivolla@my-deja.com wrote:
> @array = (1..5);
> while ($element = shift(@array)) {
> 	print("$element - ");
> }
> print ("/n");
>
> I get "1 - 2 - 3 - 4 - 5 - /n"
> which totally confuses me. Any help would be very helpfull. Thanks in
> advance.

You didn't really explain what confused you, what were you expecting?
One little typo is the "/n", you probably meant "\n" which is the
newline character [enter] on Unix platforms.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 17 Oct 2000 21:28:16 GMT
From: ivolla@my-deja.com
Subject: Re: question about shift
Message-Id: <8sig97$cbs$1@nnrp1.deja.com>



> You didn't really explain what confused you, what were you expecting?
> One little typo is the "/n", you probably meant "\n" which is the
> newline character [enter] on Unix platforms.

The whole thing confused me. But now I get it! Thanks alot to all of
you.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 17 Oct 2000 19:07:36 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: question
Message-Id: <ant171836d63fNdQ@oakseed.demon.co.uk>

In article <m31yxfpdkc.fsf@mumonkan.sunstarsys.com>, Joe Schaefer
<URL:mailto:joe+usenet@sunstarsys.com> wrote:
> Nevertheless I don't feel that I was treated very fairly by the 
> welcoming committee. I suppose by now the feeling is mutual; 
> the golden rule is a two-edged sword.

In my experience it's the nature of Usenet that whatever you
have to say, *someone* will disagree with it. In many cases
it isn't necessary to defend or justify yourself so it is
better just to let it drop rather than letting it become
heated and personal.

Having said that, someone's bound to disagree. :-)

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Tue, 17 Oct 2000 20:18:30 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Regular Expression problem
Message-Id: <x7y9znrzl4.fsf@home.sysarch.com>

>>>>> "JL" == Jürgen Lind <Juergen.Lind@iteratec.de> writes:

  JL> Content-Transfer-Encoding: 8bit

don't post in mime or html. usenet is plain text.

  JL> Probably I oversimplfied the problem when I tried to explain it in the
  JL> newsgroup...
  JL> What I would really like to have would be something like the following...

  JL> $w = 'foo' ;

  JL> @re{ qw( before after ) } = qw( (w+) \U$1 ) ;
  JL> ( $r = $w ) =~ s/$re{before}/$re{after}/ ;

  JL> print $r, "\n";

  JL> Ie. I want to make use of special chars such as \U etc. and match
  JL> variables...  This seems to complicate things at lot...

qr// will do that for you.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 17 Oct 2000 20:51:11 +0200
From: "Rob Donovan" <rob@robdon.com>
Subject: Re: Save As... Popup box
Message-Id: <39ec9f76$1_1@news.newsfeeds.com>

Thanks for the people who actually said something worth reading, I now have
the answer.

To the other people who just seem to bitch...

I'm so sorry for posting the question in 'maybe' the wrong group.

I thought that perl might be able to do something about my problem. Just
because I did not understand that it was not perl and actually the browser
should not be a problem.

Isn't this the place to learn things?????

It certainly is not very friendly!!!!

Life an't that long, relax guys.

Rob Donovan

"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrn8un5d5.a0g.mgjv@verbruggen.comdyn.com.au...
> [Please, in the future, post your reply AFTER the suitably trimmed
> test you reply to]
>
> On Mon, 16 Oct 2000 23:01:20 GMT,
> exit72@excite.com <exit72@excite.com> wrote:
>
> [fixed order of post]
>
> > On Mon, 16 Oct 2000 15:49:39 -0500, Michael Carman <mjcarman@home.com>
> > wrote:
> >
> > >Rob Donovan wrote:
> > >>
> > >> I know who to send HTML to a browser (ie print content-type
> > >> text/plain..bla bla...), but how do I make the browser download a
> > >> file or pop up the 'save as...' box?
> > >
> > >Two points:
> > >1) Despite what you may think, this isn't really a Perl question. It's
> > >   a CGI one, and there are forums specifically for CGI which will
> >
> > I think if you don't know the answer or you're not willing to help you
> > should just refrain from posting.
>
> No. Michael is correct. This is NOT a question to be answered here.
> There are two (main) reasons for this:
>
> 1) The experts on HTML, CGI and the relevant tricks and techniques are
> unlikely to be here. They hang out in a different space on Usenet, in
> the comp.infosystems.* hierarchy. Any answers from here might be
> inaccurate, and the chances of it being corrected by the people in the
> know are low.
>
> 2) Usenet is divided in spaces that each have a fairly limited topic
> to discuss. The reason for that is that it is easier to find the bits
> you're interested in, without having to wade through mountains of
> irrelevant crap. The more irrelevant crap ends up on a newsgroup, the
> less useable it becomes. The less useable a newsgroup is, the fewer
> decent people with knowledge and willingness to answer topical
> questions will read it. I am not making this up. This is a
> historically proven fact.
>
> So, you have just added to the clutter on this group. You, personally,
> have made this group less useable. You might find yourself in the
> situation, some day, where you need a good answer to something that is
> really related to Perl, and you might find that there is no one left
> on this group that knows anything about Perl. You will only find
> people posting upside down, and discussing HTML and CGI. Is that
> really what you want? Alternatively, you may find that there still are
> people who discuss Perl, but they can't see any of your posts, because
> they've all killfiled you.
>
> So, bite your tongue, and only post Perl-related answers and questions
> here. If you want to talk about HTML, go to one of the
> comp.infosystems.www.* groups. If you feel you need to answer HTML or
> CGI related questions that are posted to this group, do so in private
> email, and maybe inform the OP that they shouldn't post here again,
> unless it really is Perl they want to talk about.
>
> But, do NOT answer off-topic questions here. And even more
> importantly, do NOT flame people for correctly pointing out that HTML
> and CGI are not discussed here.
>
> Before using Usenet, you should understand the rules. Go to
> news.announce.newusers, and read some of the documentation posted
> there regularly.
>
> Martien
> --
> Martien Verbruggen              |
> Interactive Media Division      | In a world without fences, who needs
> Commercial Dynamics Pty. Ltd.   | Gates?
> NSW, Australia                  |




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: Tue, 17 Oct 2000 13:00:53 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: strange behaviour regular expression
Message-Id: <39EC93D5.5732094A@home.com>

Jens-Uwe Rumstich wrote:
> 
> I have a list of Product, which I want to compare with a string.
> Strangely the found products change, if I change the list of
> products!!!
> 

> if ($SearchTextStripped =~ /$ProductNameStripped/g)

Get rid of the trailing 'g' here -- it's causing your // to loop. (cf.
perldoc perlre) I'm guessing that you also want to add a binding for the
beginning of your string:

if ($SearchTextStripped =~ /^$ProductNameStripped/)

-mjc


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

Date: Tue, 17 Oct 2000 11:35:32 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: strange behaviour regular expression
Message-Id: <MPG.14563bd395ce83d798ae3e@nntp.hpl.hp.com>

In article <1einw1o.4mjvpjirdu6fN%tony@svanstrom.com> on Tue, 17 Oct 
2000 17:43:48 GMT, Tony L. Svanstrom <tony@svanstrom.com> says...
> Jens-Uwe Rumstich <rumstich@informatik.hu-berlin.de> wrote:
> 
> > I have a strange behavior neither I nor the PERL gurus here can explain. Since
> > this is a VERY important routine, I don't want to have it doing things I
> > can not explain!
> 
> I REALLY want you to TELL me WHAT a "PERL guru" is... 
> 
> I mean, people around this neck of usenet might know a thing or two
> about perl and Perl, but PERL? What's that?

Everyone knows what PERL is.  It is the NASDAQ symbol of Perle Systems 
Limited.

  http://www.perle.com/

>      /Tony... bored...

Obviously.  Me too...

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 17 Oct 2000 20:15:09 +0200
From: "Tony Dalbrekt" <tony.dalbrekt@swipnet.se>
Subject: write to fil
Message-Id: <IB0H5.1996$Z75.5498@nntpserver.swip.net>

When I rewrite the spliced array back to the file will the data move one
step to the right. Why, and how do I prevent that?
The data file looks like below aftar I've been rewriting it.
Not the first but the rest of the lines are indent.

100
  200
  300
  400
  500

#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
########################Variables
$news = "news.txt";
$item = 0;
########################END Variables
open (NEWS, "$news") or die "Can't open to file s!\n";
@news = <NEWS>;
close(NEWS);

splice (@news, $item, 1);

open (NEWS, ">$news");
print NEWS "@news";
close (NEWS);

file://Tony





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

Date: Tue, 17 Oct 2000 14:28:06 -0400
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: write to fil
Message-Id: <39EC9A36.1E6B2D7A@cc.gatech.edu>

Tony Dalbrekt wrote:

> When I rewrite the spliced array back to the file will the data move one
> step to the right. Why, and how do I prevent that?
> The data file looks like below aftar I've been rewriting it.
> Not the first but the rest of the lines are indent.
>
> 100
>   200
>   300
>   400
>   500
>
> #!/usr/bin/perl -w
> print "Content-type: text/html\n\n";
> ########################Variables
> $news = "news.txt";
> $item = 0;
> ########################END Variables
> open (NEWS, "$news") or die "Can't open to file s!\n";
> @news = <NEWS>;
> close(NEWS);
>
> splice (@news, $item, 1);
>
> open (NEWS, ">$news");
> print NEWS "@news";
>

The cause is this line above.  When you read the NEWS file into @news, each
entry ends with a carriage return.  When you print an array (@news in this
case), Perl will display all the elements in @news, separated by $, .  But
when you convert an array to a string, it contains all the elements
separated by $" which is usually different from $, .  By default $,='' and
$"=' ', so the above line prints all the lines in @news separated by spaces,
yielding the result you observed.  Remove the quotes and output should be
"normal".

For more info, perldoc perlvar.

--
Stephen Kloder               |   "I say what it occurs to me to say.
stephenk@cc.gatech.edu       |      More I cannot say."
Phone 404-874-6584           |   -- The Man in the Shack
ICQ #65153895                |            be :- think.




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

Date: Tue, 17 Oct 2000 14:35:55 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: write to fil
Message-Id: <Pine.GSO.4.21.0010171434450.25707-100000@crusoe.crusoe.net>

[posted & mailed]

On Oct 17, Tony Dalbrekt said:

>When I rewrite the spliced array back to the file will the data move one
>step to the right. Why, and how do I prevent that?

>open (NEWS, ">$news");
>print NEWS "@news";
>close (NEWS);

You're printing an array in quotes, which is like saying:

  print NEWS join($", @news);

The $" variable defaults to " ", so it's like saying

  print NEWS join(" ", @news);

That puts a space between the array elements, or, as it appears, before
every elements but the first.

Get rid of the quotes.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/





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

Date: Tue, 17 Oct 2000 19:35:47 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: write to fil
Message-Id: <ant1718479ddfNdQ@oakseed.demon.co.uk>

In article <IB0H5.1996$Z75.5498@nntpserver.swip.net>, Tony Dalbrekt
<URL:mailto:tony.dalbrekt@swipnet.se> wrote:
> When I rewrite the spliced array back to the file will the data move one
> step to the right. Why, and how do I prevent that?
> The data file looks like below aftar I've been rewriting it.
> Not the first but the rest of the lines are indent.
> 
> 100
>   200
>   300
>   400
>   500
[snip]
> print NEWS "@news";

When you say print NEWS "@news" the value of $" (which is by default a
space) is used to separate the values in the array. If you were
to say print NEWS @news then it is the value of $, (which is by default
the empty string) that is used to separate the values in the array.
The latter would result in none of the lines being indented.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Tue, 17 Oct 2000 19:42:41 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: write to fil
Message-Id: <ant1718413e8fNdQ@oakseed.demon.co.uk>

Drat! I need a more real-time news feed.
No point in me posting answers if everyone gets there before me.

My goodness, has it really come to this. "I *need* a real-time news
feed". I think I'm turning into a Usenet junkie. Help me Mummy!!!

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Tue, 17 Oct 2000 11:38:53 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: write to fil
Message-Id: <MPG.14563c969702bff398ae3f@nntp.hpl.hp.com>

In article <IB0H5.1996$Z75.5498@nntpserver.swip.net> on Tue, 17 Oct 2000 
20:15:09 +0200, Tony Dalbrekt <tony.dalbrekt@swipnet.se> says...
> When I rewrite the spliced array back to the file will the data move one
> step to the right. Why, and how do I prevent that?
> The data file looks like below aftar I've been rewriting it.
> Not the first but the rest of the lines are indent.
> 
> 100
>   200
>   300
>   400
>   500

 ...

> print NEWS "@news";

perlfaq5: "Why do I get weird spaces when I print an array of lines?"

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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


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