[18276] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 444 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 8 14:05:51 2001

Date: Thu, 8 Mar 2001 11:05:21 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984078321-v10-i444@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 8 Mar 2001     Volume: 10 Number: 444

Today's topics:
    Re: "local" install of perl (Andy Dougherty)
    Re: (Linux beginner) How to de-install and re-install P <mischief@velma.motion.net>
        ASP/PerlScript - Database Connection Problem <junk@spam.com>
    Re: Backreferencing in ()*-like patterns (LMC)
    Re: Backreferencing in ()*-like patterns (LMC)
    Re: Can it be done? (Villy Kruse)
        CONVERT ASCII text string to BINARY with perl cgi <nospamplease@thankyou.com>
    Re: CONVERT ASCII text string to BINARY with perl cgi <c_clarkson@hotmail.com>
        Converting dates to numbers??? <mail@ericmarques.net>
    Re: Converting dates to numbers??? <mail@ericmarques.net>
    Re: Converting dates to numbers??? <c_clarkson@hotmail.com>
        Count matches? emelin@my-deja.com
    Re: Count matches? <ubl@schaffhausen.de>
    Re: Count matches? nobull@mail.com
    Re: Emergency! Can't use LWP::Simple! (EED)
    Re: Emergency! Can't use LWP::Simple! (Tad McClellan)
    Re: Emergency! Can't use LWP::Simple! <joe+usenet@sunstarsys.com>
    Re: FAQ 6.0:   Why do I get weird spaces when I print a (Gwyn Judd)
    Re: grep question (Droogie)
    Re: Help to Install Perl <joe+usenet@sunstarsys.com>
    Re: Help to Install Perl <mischief@velma.motion.net>
    Re: Help to Install Perl <mischief@velma.motion.net>
        HELP!!! my perl writen text file deletes itself somehow <alan@afdsolutions.com>
    Re: HELP!!!! perl script that writes to a text database <alan@afdsolutions.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 08 Mar 2001 16:02:39 -0000
From: doughera@maxwell.phys.lafayette.edu (Andy Dougherty)
Subject: Re: "local" install of perl
Message-Id: <slrn9afbaf.o0g.doughera@maxwell.phys.lafayette.edu>

In article <982vgg$fj4$1@pheidippides.axion.bt.co.uk>, Bill Parker wrote:

>What I then want to do is install perl and the various modules inside this
>directory structure and make it availabel to my scripts

This is easy to do and well-supported.

>a) How do I install perl in a non-default directory? I guess I can't get
>away downloading a binary distro can I?

You can install perl wherever you like.  See the section 

	=item Installation prefix

in the INSTALL file in the perl source kit.

Subsequent modules built and installed with this perl will automatically 
end up in your /opt/billsap directory hierarchy.


You can also edit a prebuilt binary distribution to replace _all_ versions of 
    /usr/local/   with
    /opt/stuff/   
    
but you have to be very very careful about string lengths.

>b) I can probably work out how to install the modules I want without using
>the CPAN mechanism... most of them seem to be have "make/make install" type
>instructions - but any tips gratefully received

If you put /opt/billsap/bin early in $PATH, then the standard invocation

	perl Makefile.PL
	make
	make test
	make install

will just work.

>c) Do I have to do anything other than use #!/opt/billsapp/perl in order to
>use this perl? I mean, do I have to play with LD_LIBRARY_PATH or @INC in any
>way?

Nope.  It will all just work.

-- 
    Andy Dougherty		doughera@lafayette.edu
    Dept. of Physics
    Lafayette College, Easton PA 18042


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

Date: Thu, 08 Mar 2001 17:13:25 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: (Linux beginner) How to de-install and re-install Perl on Linux
Message-Id: <taffdlrm6r8f4d@corp.supernews.com>

Jorge Godoy <godoy@conectiva.com> wrote:
> On Wed, 7 Mar 2001, mgjv@tradingpost.com.au wrote:
>> 	Garry Heaton <garry@heaton6.freeserve.co.uk> wrote:
>>> I'm new to Linux/Unix and want to remove the default Perl
>>> installation, then re-install from source code because I read
>>> somewhere that the Perl libraries on some Linux distributions are
>>> incomplete. How do I remove and re-install?
>> 
>> It's better to leave the original installed, otherwise all other
>> packages managed by rpm will start whinging that you don't have perl
>> installed (and that includes bind, for crying out loud!).

> bind??? It seems like a packaging bug to me:

> [godoy@wintermute godoy]$ rpm -q --requires bind
> chkconfig  
> /bin/sh  
> ld-linux.so.2  
> libc.so.6  
> libc.so.6(GLIBC_2.0)  
> libc.so.6(GLIBC_2.1)  
> [godoy@wintermute godoy]$ rpm -q bind           
> bind-8.2.3-4cl
> [godoy@wintermute godoy]$ 

Doesn't seem that way to me. Here's what I get on RedHat 7.0
with BIND 8.2.3_REL :

# rpm -q --whatrequires perl
openssl-perl-0.9.5a-14
bind-8.2.3-1

# rpm -q --requires bind
/sbin/chkconfig
sh-utils
/bin/cat
/bin/chmod
/usr/sbin/useradd
perl
/bin/sh
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
ld-linux.so.2
libc.so.6
/bin/bash
/usr/bin/perl
libc.so.6(GLIBC_2.0)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.1.3)
libc.so.6(GLIBC_2.2)
rpmlib(CompressedFileNames) <= 3.0.4-1

Chris

-- 
Christopher E. Stith
Programming is a tool. A tool is neither good nor evil. It is
the user who determines how it is used and to what ends.



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

Date: Thu, 8 Mar 2001 14:15:41 -0000
From: "John Brown" <junk@spam.com>
Subject: ASP/PerlScript - Database Connection Problem
Message-Id: <988464$5j6$1@neptunium.btinternet.com>

Hi,

I've got an ASP page, and am trying to use PerlScript to access a database
with a DSN-less connection.

The code is...

<script language=perlscript runat=server>
$objConn = $Server->CreateObject("ADODB.Connection")
         or die "CreateObject: $!";
$connString = "Provider=Microsoft.Jet.OLEDB.4.0;";
$connString .= "Data Source=D:\\Test\\Test.mdb;";
$connString .= "User Id=;Password=;";
$objConn->Open($connString) or die "OpeningConnection: $!";
</script>

This produces an error...

> Error Type: PerlScript Error (0x80004005)
> (in cleanup) OpeningConnection:
> /scripts/search.asp, line 7

I also have the same error if I try it with a system DSN, rather than the
above connection string.

Any idea what I'm doing wrong?  I'm fairly new to Perl & ASP, and this
really has me stumped.

Regards
JB





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

Date: Thu, 08 Mar 2001 10:42:03 -0500
From: "Antoine Beaupre (LMC)" <lmcabea@lmc.ericsson.se>
Subject: Re: Backreferencing in ()*-like patterns
Message-Id: <3AA7A84B.3E596EAA@lmc.ericsson.se>

nobull@mail.com wrote:
> 
> "Antoine Beaupre (LMC)" <lmcabea@lmc.ericsson.se> writes:
> 
> > I think this is probably a stupid question, but it's not covered in the
> > faq (at least from what I read..)
> >
> > I was wondering wether it was possible to do a regexp pattern like:
> >
> > /^([0-9]+)(-[0-9]+)*/
> >
> > and access matches like: $1, $2, $3, $4, until there's no match...
> 
> Not in one step.  Bu one step is not always the most elegant.
> 
> /^([0-9]+(-[0-9]+)*)/
> my @bits = split /-/ => $1;

Indeed... I guess this is what I should've done in the first place,
split. Since anyways I'm putting the matches in an array!

A RE was a bad idea in the first place... :)

For anyone who cares, I modified my original code to be:

$del = [-\.]; # delimiters
$package =~ /^(.*)$del([0-9]+($del[0-9]+)*)$/;
$name = $1;
@version = split /$del/ => $2;

> > I guess this is impossible with perl's current (or any?) re engine, but
> 
> Actually since Perl's RE engine can now embed arbitrary code in the RE
> you probably _could_ do it wiht a single RE - but it would not
> result in readable code.

Ya.... I guess you really can do anything.. :)

But I kinda wondered why ()* produce a single $n in the first place... I
guess () would then be unuseable except for my very particular case!

Thank you all for your answers!

A.

--
La sémantique est la gravité de l'abstraction.


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

Date: Thu, 08 Mar 2001 10:51:12 -0500
From: "Antoine Beaupre (LMC)" <lmcabea@lmc.ericsson.se>
Subject: Re: Backreferencing in ()*-like patterns
Message-Id: <3AA7AA70.22D3AAEC@lmc.ericsson.se>

Abigail wrote:
> 
> Antoine Beaupre (LMC) (lmcabea@lmc.ericsson.se) wrote on MMDCCXLV
> September MCMXCIII in <URL:news:3AA69A79.4F1093D0@lmc.ericsson.se>:
> :} Hi.
> :}
> :} I think this is probably a stupid question, but it's not covered in the
> :} faq (at least from what I read..)
> :}
> :} I was wondering wether it was possible to do a regexp pattern like:
> :}
> :} /^([0-9]+)(-[0-9]+)*/
> :}
> :} and access matches like: $1, $2, $3, $4, until there's no match...
> 
> Well, in general, I don't think your problem is solvable.
> But for this particular regex, you can do things.
> 
>     my @parts = split /(?=-)/ => $string;
> 
> That will fail if there is trailing garbage after the digits though.

What do you mean, "fail"? It will take the garbage even if it's not
digits? No problem, actually, I should have put it this way:

$del = [\.-];
/^(.*)$del([0-9].*($del.*)*)$/;

Because this is to match version numbers, which could technically be
patch numbers (a, b.... etc).
 
> And if you don't care about the dashes, you could just extract
> the digits:
> 
>     my @parts = $string =~ /\d+/g;
> 
> Although that will fail on something like "12-13-14 foobar 1234132".

Why?

$ perl -e '
> my @parts = "12-13-14 foobar 1234132" =~ /\d+/g;
> print "part: @parts\n";
> '
part: 12 13 14 1234132
$

Well, of course, the between pattern should actually be _included_ in
the list, but this was not exposed in my initial post. :)

> But in both cases, you can fix the problem of trailing garbage:
> 
>     $string =~ /^([0-9]+)(-[0-9]+)*/ and my @parts = $& =~ /\d+/g;

Yes. Good.
 
> [ Interlude: headless people ranting about the use of $&, without even
>   knowing whether it's significant or not. ]

Ya lost me there, buddy. :)
 
> It would be nice if you could get all the submatches instead of just
> the last one (when working with modifiers).

Yes... since there are modifiers to regexps, why not put a /a modifier
(say) to make ()* return many matches? :)

Anyways, thanks again!

A.

--
La sémantique est la gravité de l'abstraction.


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

Date: 8 Mar 2001 16:58:12 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Can it be done?
Message-Id: <slrn9afeg3.6j3.vek@pharmnl.ohout.pharmapartners.nl>

On Thu, 08 Mar 2001 12:14:58 GMT, Tomas <tomas@place1.com> wrote:
>Hi Guys,
>
>Is there any pre written scripts or applications out there who can 
>handle the following tasks. (The same way as wget can handle it, except 
>that wget not seems to be able to handle https:// request).
>
>1. Remotely login to a secure web site https://www.domain.com/ using 
>assigned user name and password.
>
>2. Switch to different specified pages and download the complete HTML 
>page.
>
>Any help would be very appreciated.
>


Use the SSLeay perl module.  It is either Crypt::SSLeay or Net::SSLeay
that works together with LWP to provide access to https:// pages.

Might want to get both from CPAN and install them.  The openssl package
from www.openssl.org is also required.


Villy


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

Date: Thu, 8 Mar 2001 13:23:21 -0500
From: "null" <nospamplease@thankyou.com>
Subject: CONVERT ASCII text string to BINARY with perl cgi
Message-Id: <988imc$ibt$1@bob.news.rcn.net>

I want to do something that it seems hasn't been done very many times
before - I want to send a string to a perl cgi script (probably from a
shockwave or flash movie) and output a binary file (like png, gif, jpeg,
etc).  I've skimmed the gif89a spec
(http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/GIF89a.txt) and I understand that
it will be a pain to get my concept going (chunk this, chunk that), but I
don't care.  This is a personal project and I'm not operating under a strict
time constraint.

I've searched with Google and through all of the Usenet archives without
really finding anything.  I did locate the page for the HandyCrypt perl
module, which includes a function that is supposed to handle ascii to binary
conversion, but I'm on virtual hosting and I don't think that I can be
installing my own modules.  Basically I'm looking for a script that will
perform ascii text to binary conversions that I can install in my cgi-bin
and hack into until it does what I want it to do.

I'm a perl newbie, but willing to put in the time necessary to make this
work.  If you need more info (like which mods are installed on my hosting
server), just let me know - I will be following this thread closely.

Thanks for all of your help.

brian

(I also posted this to ciwac, and will be grateful for replies to either
message)




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

Date: Thu, 8 Mar 2001 12:59:51 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: CONVERT ASCII text string to BINARY with perl cgi
Message-Id: <0F23C444413EAE38.7DCF473B112DF7DC.9191584DDEEF1580@lp.airnews.net>

brian <nospamplease@thankyou.com> wrote
:
: I want to do something that it seems hasn't been done very many times
: before - I want to send a string to a perl cgi script (probably from a
: shockwave or flash movie) and output a binary file (like png, gif, jpeg,
: etc).  I've skimmed the gif89a spec
: (http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/GIF89a.txt) and I
: understand that it will be a pain to get my concept going (chunk this,
: chunk that), but I don't care.  This is a personal project and I'm not
: operating under a strict time constraint.

    Try the modules at: http://search.cpan.org/Catalog/Graphics/.

:
: I've searched with Google and through all of the Usenet archives without
: really finding anything.  I did locate the page for the HandyCrypt perl
: module, which includes a function that is supposed to handle ascii to
binary
: conversion, but I'm on virtual hosting and I don't think that I can be
: installing my own modules.  Basically I'm looking for a script that will
: perform ascii text to binary conversions that I can install in my cgi-bin
: and hack into until it does what I want it to do.

    You can install modules anywhere you like. No need to wait for
your host to do it for you. Look in the perl documentation for the
'lib' module  or use the -I switch.
http://www.perl.com/CPAN-local/doc/manual/html/pod/perlrun.html
        'Directories specified by -I are prepended to the search path
    for modules (@INC)'

HTH,
Charles K. Clarkson





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

Date: Thu, 08 Mar 2001 18:17:43 GMT
From: "Eric" <mail@ericmarques.net>
Subject: Converting dates to numbers???
Message-Id: <b1Qp6.12038$PF4.17433@news.iol.ie>

I need to know how to covert dates to numbers like the ones time() outputs
eg...
to covert somethink like 31/3/2001 12:00:00AM should covert to the relevant
number like 943534342
(the time will always be 12AM)
dates converted will always be a future date

plz help




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

Date: Thu, 08 Mar 2001 18:18:55 GMT
From: "Eric" <mail@ericmarques.net>
Subject: Re: Converting dates to numbers???
Message-Id: <j2Qp6.12039$PF4.17476@news.iol.ie>

oops i entered that date wrong
i mean 31/03/2001 not 31/3/2001
DD/MM/YYYY


"Eric" <mail@ericmarques.net> wrote in message
news:b1Qp6.12038$PF4.17433@news.iol.ie...
> I need to know how to covert dates to numbers like the ones time() outputs
> eg...
> to covert somethink like 31/3/2001 12:00:00AM should covert to the
relevant
> number like 943534342
> (the time will always be 12AM)
> dates converted will always be a future date
>
> plz help
>
>




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

Date: Thu, 8 Mar 2001 12:42:13 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: Converting dates to numbers???
Message-Id: <F81E3004E7FBFA19.2BF3692CD9D5F4CA.FD17F891FE988CF6@lp.airnews.net>

Eric <mail@ericmarques.net> wrote
: oops i entered that date wrong
: i mean 31/03/2001 not 31/3/2001
: DD/MM/YYYY
:
:
: "Eric" <mail@ericmarques.net> wrote in message
: news:b1Qp6.12038$PF4.17433@news.iol.ie...
: > I need to know how to covert dates to numbers like the ones time()
outputs
: > eg...
: > to covert somethink like 31/3/2001 12:00:00AM should covert to the
: relevant
: > number like 943534342
: > (the time will always be 12AM)
: > dates converted will always be a future date
: >
: > plz help

    According tho the docs on localtime:

        Also see the Time::Local module (to convert the second, minutes,
    hours, ... back to seconds since the stroke of midnight the 1st of
    January 1970, the value returned by time()), and the strftime(3) and
    mktime(3) functions available via the POSIX module.

HTH,
Charles K. Clarkson






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

Date: 8 Mar 2001 14:28:55 GMT
From: emelin@my-deja.com
Subject: Count matches?
Message-Id: <9884v7$srq$1@news.netmar.com>

foreach ...whatever... {
     if ...whatever... {
          print $match;
     }
}


Can I somehow count the number of matches???





 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net


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

Date: Thu, 08 Mar 2001 17:59:18 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: Count matches?
Message-Id: <3AA7BA66.F8708626@schaffhausen.de>

emelin@my-deja.com schrieb:
> 
> foreach ...whatever... {
>      if ...whatever... {
>           print $match;
>      }
> }
> 
> Can I somehow count the number of matches???

my $i = 0;
> foreach ...whatever... {
>      if ...whatever... {
>           print $match;
		   $i++;
>      }
> }

print "Number of matches: $i"

This certaily easier that the other stuff you do here :-)

->malte


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

Date: 08 Mar 2001 17:57:45 +0000
From: nobull@mail.com
Subject: Re: Count matches?
Message-Id: <u9snkodtye.fsf@wcl-l.bham.ac.uk>

emelin@my-deja.com writes:

> foreach ...whatever... {
>      if ...whatever... {
>           print $match;
>      }
> }
> 
> 
> Can I somehow count the number of matches???

my $count = 0;

foreach ...whatever... {
     if ...whatever... {
          print $match;
	  $count ++;
     }
}

print "Total matches: $count\n";

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 08 Mar 2001 16:04:37 +0100
From: "Alexander Farber (EED)" <eedalf@eed.ericsson.se>
Subject: Re: Emergency! Can't use LWP::Simple!
Message-Id: <3AA79F85.57673582@eed.ericsson.se>

emelin@my-deja.com wrote:
> 
> I recently had to switch webservers, and now I'm stuck with one that doesn't
> support LWP::Simple! I noticed that my cgi scripts using this module wouldn't
> work, and after being in contact with the server admin, I found out that the
> module wasn't installed!
> 
> Does anyone know another way to do what LWP::Simple getstore() and get() do?!?
> Can I get around this problem?
> 
> And what do you think about a server that doesn't support LWP::Simple?! I've
> tried a couple of other ones before and never had any problems!

Why don't you download it from http://serach.cpan.org and install into your
home dir by using perl Makefile.PL PREFIX=/home/you (or LIB=/home/you/lib)?


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

Date: Thu, 08 Mar 2001 17:08:56 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Emergency! Can't use LWP::Simple!
Message-Id: <slrn9af1fe.d2o.tadmc@tadmc26.august.net>

emelin@my-deja.com <emelin@my-deja.com> wrote:

>I recently had to switch webservers, and now I'm stuck with one that doesn't
>support LWP::Simple! I noticed that my cgi scripts using this module wouldn't
>work, and after being in contact with the server admin, I found out that the
>module wasn't installed!

>Can I get around this problem?


Install the libwww bundle yourself, you do not require the sysadmin
if you have shell access.


perldoc -q module

   "How do I keep my own module/library directory?"


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 08 Mar 2001 12:24:23 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Emergency! Can't use LWP::Simple!
Message-Id: <m3itlkfa2g.fsf@mumonkan.sunstarsys.com>

tadmc@augustmail.com (Tad McClellan) writes:

> emelin@my-deja.com <emelin@my-deja.com> wrote:
> 
> >I recently had to switch webservers, and now I'm stuck with one 
> >that doesn't support LWP::Simple! I noticed that my cgi scripts 
> >using this module wouldn't work, and after being in contact with 
> >the server admin, I found out that the module wasn't installed!
> 
> >Can I get around this problem?
> 
> 
> Install the libwww bundle yourself, you do not require the sysadmin
> if you have shell access.

If he doesn't have "shell" access, he could always write a CGI script
that will do the local install on the web host.  I've done this a
few times, even installed some XS modules that way. It may require some
chmod games though.

-- 
Joe Schaefer                "Sacred cows make the best hamburger."
                                               --Mark Twain


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

Date: Thu, 08 Mar 2001 18:45:07 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: FAQ 6.0:   Why do I get weird spaces when I print an array of lines?
Message-Id: <slrn9afl3e.334.tjla@thislove.dyndns.org>

I was shocked! How could PerlFAQ Server <faq@denver.pm.org>
say such a terrible thing:
>  Why do I get weird spaces when I print an array of lines?
>
>    Saying
>
>        print "@lines\n";
>
>    joins together the elements of `@lines' with a space between them. If

This is a ridiculous answer. "Why did X happen when I did Y?" "That's
because when you do Y, X happens". How about mentioning the `$"'
variable?
Something like:

The expression 

"@array";

yeilds a string consisting of each element of @array join() 'ed using
the contents of the global variable `$"'. By default this variable is a ' '
character so if the contents of @array was ("little", "fluffy",
"clouds"), then the statement

print "@array";

would print:

    little fluffy clouds

To change how an array is interpolated into a string, simply set the
value of the `$"' to some other string.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Main's Law:
	For every action there is an equal and opposite government program.


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

Date: Thu, 08 Mar 2001 15:16:46 GMT
From: Ireally@dontthinkso.com (Droogie)
Subject: Re: grep question
Message-Id: <3aa7a1b9.78457164@reading.news.pipex.net>

Id have used:
m/([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/

hey you did mention a regex debate

;)

Andy

On Thu, 8 Mar 2001 14:10:05 +0930, "Wyzelli" <wyzelli@yahoo.com>
wrote:

>"Jason Larson" <jlarson@linuxmail.org> wrote in message
>news:tadvuf566tvs93@corp.supernews.com...
>> I am new to perl scripting.  I am writing a script to grep a file for
>IP
>> addys.  Im using something like this
>> after opening the file and declaring an array.  print grep /\d/,
>@lines;
>>
>> greps the file fine but I would prefer 2 things:
>> 1) only grabs the IP and not the whole line
>> 2) only the first instance of the IP
>>
>> any help would be great.
>>
>
>You could try:
>for (@lines){
>    print "$1\n" if m/(\d+\.\d+\.\d+\.\d+)/; # alternative IP regexes
>left to debate
>}
>
>Wyzelli
>--
>($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass
>it around');
>for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
>$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";
>
>
>
>



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

Date: 08 Mar 2001 10:52:35 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Help to Install Perl
Message-Id: <%TNp6.3938$L67.91840@news1.atl>

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:

> According to Suzanne <sbucciarelli1@home.com>:
> > Here's a ploink back at ya ... Thanks to some helpful advice from these
> > newsgroups, I now have Perl installed and running as well....
> 
> You also made sure you'll have a hard time if you ever want advice from
> this group again.

From: "Suzanne" <dream1625@aol.com>
                           ^^^
[...]

X-Newsreader: Microsoft Outlook Express 5.00.2615.200
                        ^^^^^^^^^^^^^^^
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
^^^^^^^^^

I'd say it'll be damn near impossible.

-- 
Joe Schaefer   "Under certain circumstances, profanity provides a relief denied
                                       even to prayer."
                                               --Mark Twain


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

Date: Thu, 08 Mar 2001 17:40:08 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Help to Install Perl
Message-Id: <tafgvoh58cjq2d@corp.supernews.com>

Obviously I didn't score her down far enough. 

Suzanne <dream1625@aol.com> wrote:
> Here's a ploink back at ya ... Thanks to some helpful advice from these
> newsgroups, I now have Perl installed and running as well.  Thanks to those
> who led me to the right place to get that accomplished.

> As for "top posting" ... not familiar with any particular
> etiquette... if that means that you type where your cursor
> goes automatically in my news reader instead of scrolling
> through material already read, whooooops ... guess I'm guilty.

Yes, you are. You quoted the whole damn previous post. You didn't
respond to points in context of the original post. That makes you
guilty of a particularly rude form of top-posting.

This wastes my time and the time of many others reading the thread.
That makes it rude, incourteous, and egoistic to put your time taken
to hit the little down arrow before the time required to download,
read, and cross-reference your post. (Although I don't care so much
about download times myself, not everyone has the connection I do.)

> As far as your remark about being rude to nobull .... nobull was
>rude to me first

Hardly. If you notice nobull asking you not to spam, that's because
you spammed. You posted the same question here as in c.l.p.modules,
where it was off-topic and nobull was kind enough to help you anyway.
I wouldn't say that is being initially rude on his part. In fact, I
have read his response to you there, and it seems quite friendly in
nature and tone.

This wastes more time and bandwidth. Rude, incourteous, and egoistic
of you to place your post in each group by hand so our newsreaders
show it more than once, wasting our time.

> and I responded back, as is my fashion when those who think they
> patrol and control the Internet in some way respond with their
> nasty little messages.

No one here thinks he or she controls the Internet. If any of us did,
you would likely not be _able_ to post in the manner you did. On the
contrary, we, in this large of a technical group, believe that since
no one does have control over the whole Internet that manners are
particularly more helpful than they might be otherwise.

> That being said, again ... thanks to those who responded back
> with helpful info.

Including nobull, I would guess. Perhaps you should remember who
helped you before being so hasty to be rude to people, and you then
wouldn't stomp on toes that had been used to give you a boost.

Now, you're getting even more rude. Time to score you down _again_.
Gee, you're numbers one and two on my plonk list. Congratulations.
Perhaps that will feed your patriotism as being a crude, incourteous,
and egotistic `red-blooded American'. If you take a wild guess at
where I live, you might find out that I'm as American as you. Parts
of my family have likely been here much longer than yours, in fact.
Does that give me the right to be indiscriminately self-centered in
an international forum and waste everyone's time, American or not?
I don't think so. Too bad you disagree, and to the embarrassment of
your fellow Americans insist it is your right to put yourself before
a group of thousands.

Perhaps a score-down of 3000?

*dekaplonk* *dekaplonk* *dekaplonk*
(tin plonks by 100 points by default ;-)

Chris

-- 
Christopher E. Stith
Product shown enlarged to make you think you're getting more.



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

Date: Thu, 08 Mar 2001 17:41:00 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Help to Install Perl
Message-Id: <tafh1cehuoqs64@corp.supernews.com>

Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:

>> According to Suzanne <sbucciarelli1@home.com>:
>> > Here's a ploink back at ya ... Thanks to some helpful advice from these
>> > newsgroups, I now have Perl installed and running as well....
>> 
>> You also made sure you'll have a hard time if you ever want advice from
>> this group again.

> From: "Suzanne" <dream1625@aol.com>
>                            ^^^
> [...]

> X-Newsreader: Microsoft Outlook Express 5.00.2615.200
>                         ^^^^^^^^^^^^^^^
> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
> ^^^^^^^^^

> I'd say it'll be damn near impossible.

LMAO. True, the clueless tend to stay that way.

-- 
Christopher E. Stith
If they can get you asking the wrong questions, they don't
have to worry about the answers.
  -- Thomas Pynchon, Gravity's Rainbow



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

Date: Thu, 08 Mar 2001 17:44:17 GMT
From: "alan scanlon" <alan@afdsolutions.com>
Subject: HELP!!! my perl writen text file deletes itself somehow at random.
Message-Id: <RxPp6.37834$W05.7754120@news1.rdc1.mi.home.com>

My perl script below writes to a text file called preferences.txt that holds
a user's preferences on each new line of a text file. The problem is that
somehow at random my perl code will now just delete the entire
preferences.txt file at random losing any new data and all the data that had
been posted into that file. And so then i have to reupload a backed up older
preferences.txt file losing any new data and preferences that the user has
posted. I think there is a bug in my perl code below.

Please have a look and let me know of the best solution to fix my existing
code.

Thank you in advance, alan (aka: perl_newbie)


################### STARTS HERE

sub change_preferences {
     $data="preferences.txt";
     $tempfile="$data.tmp";

     open(FILE, $data) or die "Error opening file: $data $!\n";
     open (TEMP, ">$tempfile") or die "Error opening file: $!\n";

     flock TEMP, $EXCLUSIVE;
     $temp = "";
     while(<FILE>)
     {
              ($key,$value) = split /\|/, $_;
              $val = $q->param($key);

    if ($val)
           {

     $val =~ s/<br>/\n/g;
     $val =~ s/\n/<br>/g;

                $preferences{$key} = $val;
                chomp $preferences{$key};
                $temp .= "$key\|$val\n";
           }
          else
          {

         chomp $value;
               $preferences{$key} = $value;
               $temp .= $_;

          }
     }

     chomp $temp;
     print TEMP $temp;
     flock FILE, $EXCLUSIVE;
     unlink($data);
     rename($tempfile,$data);
     flock FILE, $UNLOCK;
     flock TEMP, $UNLOCK;
     close(TEMP);
     close(FILE);

}


sub set_preferences {
     $data="preferences.txt";
     open(FILE, $data) or die "Error opening file: $data $!\n";
     while(<FILE>)

     {
          ($key,$value) = split /\|/, $_;
          chomp $value;
          $preferences{$key} = $value;
     }


     close(FILE);
}

################### ENDS HERE




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

Date: Thu, 08 Mar 2001 17:47:18 GMT
From: "alan scanlon" <alan@afdsolutions.com>
Subject: Re: HELP!!!! perl script that writes to a text database question.
Message-Id: <GAPp6.37836$W05.7755078@news1.rdc1.mi.home.com>

My perl script below writes to a text file called preferences.txt that holds
a user's preferences on each new line of a text file. The problem is that
somehow at random my perl code will now just delete the entire
preferences.txt file at random losing any new data and all the data that had
been posted into that file. And so then i have to reupload a backed up older
preferences.txt file losing any new data and preferences that the user has
posted. I think there is a bug in my perl code below.

Please have a look and let me know of the best solution to fix my existing
code.

Thank you in advance, alan (aka: perl_newbie)


################### STARTS HERE

sub change_preferences {
     $data="preferences.txt";
     $tempfile="$data.tmp";

     open(FILE, $data) or die "Error opening file: $data $!\n";
     open (TEMP, ">$tempfile") or die "Error opening file: $!\n";

     flock TEMP, $EXCLUSIVE;
     $temp = "";
     while(<FILE>)
     {
              ($key,$value) = split /\|/, $_;
              $val = $q->param($key);

    if ($val)
           {

     $val =~ s/<br>/\n/g;
     $val =~ s/\n/<br>/g;

                $preferences{$key} = $val;
                chomp $preferences{$key};
                $temp .= "$key\|$val\n";
           }
          else
          {

         chomp $value;
               $preferences{$key} = $value;
               $temp .= $_;

          }
     }

     chomp $temp;
     print TEMP $temp;
     flock FILE, $EXCLUSIVE;
     unlink($data);
     rename($tempfile,$data);
     flock FILE, $UNLOCK;
     flock TEMP, $UNLOCK;
     close(TEMP);
     close(FILE);

}


sub set_preferences {
     $data="preferences.txt";
     open(FILE, $data) or die "Error opening file: $data $!\n";
     while(<FILE>)

     {
          ($key,$value) = split /\|/, $_;
          chomp $value;
          $preferences{$key} = $value;
     }


     close(FILE);
}

################### ENDS HERE


"Bob Walton" <bwalton@rochester.rr.com> wrote in message
news:3AA43D24.A4B0AE1F@rochester.rr.com...
> Bob Walton wrote:
> ...
> > Well, you should probably just convert the various possible forms of
> > newlines in your data into <br>, which could be done with:
> >
> >      $var=~s/[\012\015]+/<br>/g;
> >
> > assuming that variable $var has your data in it.  That will convert any
> > run of carriage return and newline characters into a <br>, and will take
> > care of the problem whether the data comes at you in Unix, Windoze, or
> > Mac ASCII format, and will also convert several returns in a row to a
> > <br> (those nasty users!).
> > --
> > Bob Walton
>
> Just thought maybe I should followup with a warning that, since you are
> treating your user's input as HTML code, you might want to strip out any
> nasties the user might insert, like, for example:
>
>     <a href="file://path/to/some/secret/file">click here for goodies</a>
>
> When you display this back to the user, they will get a link that will
> display your secret/file on your server computer.  There might even be
> more nefarious things a user could insert into such a security hole.
> --
> Bob Walton




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

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 V10 Issue 444
**************************************


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