[11034] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4634 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 12 21:02:42 1999

Date: Tue, 12 Jan 99 18:00:28 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 12 Jan 1999     Volume: 8 Number: 4634

Today's topics:
        AnyDBM_File doesn't define an EXISTS method  (Bill Moseley)
        Array problem <rafiqmateen@netscape.net>
    Re: Array problem <jdf@pobox.com>
        associative arrays (hashes) bluepuma@mailexcite.com
    Re: associative arrays (hashes) <jdf@pobox.com>
        Can't produce miniperl while installing perl5.005_02 <cfeng@cs.mcgill.ca>
        cgi programmer needed goodtimeweb@my-dejanews.com
    Re: cgi programmer needed <uri@ibnets.com>
        declare integer unsigned ? bluepuma@mailexcite.com
    Re: File IO (Corrected reply address this time) (Tad McClellan)
    Re: File IO (Corrected reply address this time) (Tad McClellan)
        flock and dbmopen? <gbc1@axe.humboldt.edu>
    Re: flock and dbmopen? <jdf@pobox.com>
    Re: flock and dbmopen? (Bill Moseley)
    Re: how can I redirect the standard input to a file? <kistler@gmx.net>
    Re: How to stop perldoc scroll on find? <design@raincloud-studios.com>
    Re: How to stop perldoc scroll on find? <due@murray.fordham.edu>
    Re: I don't know ANYTHING birgitt@my-dejanews.com
    Re: Ignoring Comments while Parsing C/C++ Header Files (Abigail)
    Re: Ignoring Comments while Parsing C/C++ Header Files (John Stanley)
    Re: Merging multiple files together........ (Tad McClellan)
        newsgroups - CGI specific? (WAS: Re: help) <ludlow@us.ibm.com>
    Re: NT User Admin Script (Jere Julian - Personal Account)
    Re: paragraphs (Tad McClellan)
    Re: Perl Criticism <uri@ibnets.com>
    Re: Perl Criticism <mds-resource@mediaone.net>
    Re: Perl Criticism <mds-resource@mediaone.net>
    Re: Perl Criticism (Tad McClellan)
        Perl Script wanted for possible profitable project (Gary Baker)
    Re: Randal's code [was Re: How do I delete tmp files ba <jdf@pobox.com>
    Re: rounding <rick.delaney@home.com>
        Simple Question lists of lists - please help!! (Dave Underwood)
    Re: subroutine returning an lvalue <B.A.McCauley@bham.ac.uk>
    Re: substituting an exact negated string: can I? <kistler@gmx.net>
        Using require command <morrowp@tcd.ie>
    Re: Using require command <jeromeo@atrieva.com>
    Re: Verify an email address <uri@ibnets.com>
    Re: Verify an email address (John Stanley)
    Re: Verify an email address <jdf@pobox.com>
    Re: Verify an email address <uri@ibnets.com>
    Re: white paper on how Perl interpreter works or design (Alastair)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 12 Jan 1999 16:53:25 -0800
From: moseley@best.com (Bill Moseley)
Subject: AnyDBM_File doesn't define an EXISTS method 
Message-Id: <MPG.11058956ef39c551989682@nntp1.ba.best.com>

A couple of quick questions:

1) `exists' doesn't seem to work for me with dbm tied hashes (see below) 
unless I use DB_File;.

Is `defined ${'somekey'}' the way to check that a key exists or is it 
recommended that I use DB_File;?  (DB_File isn't installed on my local 
copy of perl.)


2) Any reason to use DB_File; instead of just using dbmopen?  It's a 
small database and I don't plan on using any of the features offered
by the other DBM libraries.


3) How does one check write errors?  That is, how do I check that
$db{'somekey'} = 'some data' actually gets written to disk?



46) ~ %cat x.pl
#!/usr/local/bin/perl5.005 -w

use strict;
# use diagnostics;  # turns on -w

    my %db;

    dbmopen(%db, 'db',0664) or die "failed to open $!";

    print 'yippee' if exists $db{'somekey'};



47) ~ %perl5 x.pl
AnyDBM_File doesn't define an EXISTS method at x.pl line 11

48) ~ %perl5 -v

This is perl, version 5.004_04 built for i386-freebsd

Copyright 1987-1997, Larry Wall

Perl may be copied only under the terms of either the Artistic License or 
the GNU General Public License, which may be found in the Perl 5.0 source 
kit.
         

-- 
Bill Moseley mailto:moseley@best.com


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

Date: Tue, 12 Jan 1999 20:00:43 -0500
From: Rafiq Mateen <rafiqmateen@netscape.net>
Subject: Array problem
Message-Id: <369BF03B.E216958D@netscape.net>

This is a multi-part message in MIME format.
--------------5EA0DA450B87BD64EF42DC17
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I have been looking at my computer stumped for two days now help.

I have two arrays I need to combine together examples below.

@one:


here we are now at
one two  three four
it is time to go
five six seven eight


@two:

1654 just go no
jordan retired wow
now what is up
56 19200 net of the


They are both single dimensional arrays

I need them to look like this when combined:



here we are now at  1654 just go no
one two  three four jordan retired wow
it is time to go    now what is up
five six seven eight 56 19200 net of the


HELP!!!!!!
--------------5EA0DA450B87BD64EF42DC17
Content-Type: text/x-vcard; charset=us-ascii;
 name="rafiqmateen.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Rafiq Mateen
Content-Disposition: attachment;
 filename="rafiqmateen.vcf"

begin:vcard 
n:Maten;Rafiq 
x-mozilla-html:FALSE
org:USAF
adr:;;;;;;
version:2.1
email;internet:rafiqmateen@netscape.net
title:Computer Programmer
x-mozilla-cpt:;-20624
fn:Rafiq  Maten
end:vcard

--------------5EA0DA450B87BD64EF42DC17--



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

Date: 13 Jan 1999 02:32:36 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Rafiq Mateen <rafiqmateen@netscape.net>
Subject: Re: Array problem
Message-Id: <m34spw5557.fsf@joshua.panix.com>

Rafiq Mateen <rafiqmateen@netscape.net> writes:

> This is a multi-part message in MIME format.

Ouch.  See if you can set up your news client so that it spits out
plain text.  And turn off that silly vcard!

> I have been looking at my computer stumped for two days now help.

You really should get up once in a while and rub your butt a bit, so
that the blood doesn't pool there.  HTH!  Oh wait, there's more...

> I have two arrays I need to combine together examples below.
[snip]
> They are both single dimensional arrays
[snip]

> HELP!!!!!!

Hmm.  Do you know how to access a single element of an array, given an 
index into the array?

   $array[$index]

Do you know how to loop through the valid numeric indices of an array?

   for ($i = 0; $i < @array; ++$i) { }

Do you know how to concatenate strings?

   $string_a . $string_b

Or perhaps you'd like some space between the strings...

   "$string_a $string_b"
   $string_a . ' ' . $string_b
   sprintf "%-30s %s", $string_a, $string_b

Do you know how to assign an expression to a variable?

   $a_variable = "a term" . "another term";

I think those are all the pieces you need.

Of course, you can always

   @joined = map { "$one[$_] $two[$_]" } 0..$#one;

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Wed, 13 Jan 1999 01:17:49 GMT
From: bluepuma@mailexcite.com
Subject: associative arrays (hashes)
Message-Id: <77gs7m$grn$1@nnrp1.dejanews.com>

Hi there,

I want to use an associative array with IP addresses as index.

$ip1="123.456.123.456";
$ip2="123.123.123.123";

%no=();
$no[$ip1]=1;
$no[$ip2]++;
print $no[$ip1];

But it results in "2", cause perl only takes the first number
of the IP address as index. How can I change that ?

regards   Michael

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 13 Jan 1999 02:38:31 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: bluepuma@mailexcite.com
Subject: Re: associative arrays (hashes)
Message-Id: <m31zl054vc.fsf@joshua.panix.com>

bluepuma@mailexcite.com writes:

> %no=();
> $no[$ip1]=1;

Using the -w switch would have caught that.  $ip1 is not a number, and 
you're referring to the array @no by using those []s.  You mean

  $no{$ip1} = 1;

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Tue, 12 Jan 1999 20:03:07 -0500
From: Chengbin FENG <cfeng@cs.mcgill.ca>
Subject: Can't produce miniperl while installing perl5.005_02
Message-Id: <369BF0CB.D7C@cs.mcgill.ca>

Hi,

When I try to install perl5.005_02 on Solaris 2.5.1 on a Sun Sparc
platform, after the "sh configure", I type "make", and the following
message comes out, and I got stuck here:

 .......
`sh  cflags libperl.a perlio.o`  perlio.c
	  CCCMD =  gcc -B/usr/ccs/bin/ -DPERL_CORE -c -I/usr/local/include
-I/opt/gnu/include -O   
rm -f libperl.a
ar rcu libperl.a perl.o malloc.o gv.o toke.o perly.o op.o regcomp.o
dump.o util.o mg.o byterun.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o
pp_ctl.o pp_sys.o doop.o doio.o regexec.o taint.o deb.o universal.o
globals.o perlio.o 
gcc -B/usr/ccs/bin/  -L/usr/local/lib -L/opt/gnu/lib -o miniperl
miniperlmain.o libperl.a -lsocket -lnsl -lm -lc -lcrypt 
Undefined			first referenced
 symbol  			    in file
PL_thrsv                            libperl.a(malloc.o)
pthread_getspecific                 libperl.a(malloc.o)
PL_malloc_mutex                     libperl.a(malloc.o)
PL_thr_key                          libperl.a(malloc.o)
PL_threadnum                        libperl.a(malloc.o)
ld: fatal: Symbol referencing errors. No output written to miniperl
make: *** [miniperl] Error 1


I am using GCC. Can some one give some hint on it? 

Thanks a lot.

-- Wallace FENG


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

Date: Tue, 12 Jan 1999 23:58:50 GMT
From: goodtimeweb@my-dejanews.com
Subject: cgi programmer needed
Message-Id: <77gnjm$coo$1@nnrp1.dejanews.com>

we are in search of a cgi programmer who can finish a project which is
already in progress.  the project is an interactive game on one of our
clients websites. the game can be viewed at www.a-a-n.com/test/maingame.htm .
the client is in desperate need for the game to work, because it is featured
in their brochure which has been handed out nation wide.

currently, the game only works halfway in microsoft explorer. an error page
will come up on either browser after clicking the submit button. the webmaster
for the host server has pointed out that the script is trying to use cgi-lib
which is not currently supported on that server.  he suggested that the script
be made without reference to cgi-lib.

if there is anyone who can solve our dilema please send us a quote of time
and cost, and i'm sure we can work something out. my email is
roger@goodtimeweb.com.

thanks
roger

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 12 Jan 1999 19:43:03 -0500
From: Uri Guttman <uri@ibnets.com>
To: goodtimeweb@my-dejanews.com
Subject: Re: cgi programmer needed
Message-Id: <39sodg3svc.fsf@ibnets.com>

>>>>> "g" == goodtimeweb  <goodtimeweb@my-dejanews.com> writes:

  g> we are in search of a cgi programmer who can finish a project which is
  g> already in progress.  the project is an interactive game on one of our
  g> clients websites. the game can be viewed at www.a-a-n.com/test/maingame.htm .
  g> the client is in desperate need for the game to work, because it is featured
  g> in their brochure which has been handed out nation wide.

  g> currently, the game only works halfway in microsoft explorer. an error page
  g> will come up on either browser after clicking the submit button. the webmaster
  g> for the host server has pointed out that the script is trying to use cgi-lib
  g> which is not currently supported on that server.  he suggested that the script
  g> be made without reference to cgi-lib.

  g> if there is anyone who can solve our dilema please send us a quote of time
  g> and cost, and i'm sure we can work something out. my email is
  g> roger@goodtimeweb.com.

if it is a recent release of perl, it is installed. it has a cgi-lib
compatibility mode. 2 lines of code should do it for you. i will send you a
bill if you want.

use CGI qw( :cgi-lib ) ;
CGI::ReadParse ;


now %in will be set as cgi-lib would have set it.

hth,

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Wed, 13 Jan 1999 01:11:22 GMT
From: bluepuma@mailexcite.com
Subject: declare integer unsigned ?
Message-Id: <77grrk$gf4$1@nnrp1.dejanews.com>

Hi there,

I'm dealing a lot with IP addresses and I want to convert them
to a simple integer.

This gives me a coredump:
$ip = $i1*256*256*256+$i2*256*256+$i3*256+$i4;

And this gives me a negative number:
$ip = ($i1 << 24) + ($i2 << 16) + ($i3 << 8) + $i4;

Is there a way to avoid that ?


regards   Michael

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 12 Jan 1999 19:18:24 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: File IO (Corrected reply address this time)
Message-Id: <09sg77.ts1.ln@magna.metronet.com>

Tad McClellan (tadmc@metronet.com) wrote:


:       print "$1\n" while /some pattern here/g;


   Doh!

   make that:

      print "$1\n" while /(some pattern here)/g;
                          ^                 ^


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 12 Jan 1999 19:06:28 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: File IO (Corrected reply address this time)
Message-Id: <kirg77.fo1.ln@magna.metronet.com>

smoothasice@geocities.com wrote:
: I was wondering if there was a command or a sequence of commands that I
: could use to actually cut a piece of information out of a file and store
: it in a variable...


   Most things are possible in Perl.

   But you neglected to share with us what criterion is to be
   used to identify the part of the file that you want to capture.


   Get lines 10 through 20:

      while (<>) {
         $some_lines .= $_ if 10 .. 20;
      }


   Get lines starting with a line that contains START and ending
   with a line that contains END


      while (<>) {
         $some_lines .= $_ if /START/ .. /END/;
      }


   Grab text from somewhere "in the middle":

      {   local $/;   # slurp mode

          $the_entire_file = <>;
      }

      print "$1\n" while /some pattern here/g;



: if not, what commands can I use to make the "Print"
: command print to the beginning of the file instead of the end.



--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 12 Jan 1999 16:33:30 -0800
From: Greg Coit <gbc1@axe.humboldt.edu>
To: Jim Hubbard <jimh@sgi.com>
Subject: flock and dbmopen?
Message-Id: <369BE9D9.4595151@axe.humboldt.edu>

Hello folks,

I've been trying to lock a db file after opening it with dbmopen (not
sure which flavor, NDBM, SDBM, or ?) without any luck.  After searching
all the info I could find regarding flock, I'm starting to come to the
conclusion there is no easy way to do this without tie (not that there
is anything wrong with tie, I've just never used it before).  Anybody
out there know of a way to flock a database file opened with dbmopen?
Below is what I was hoping would work:

$LOCK_SH = 1;
$LOCK_EX = 2;
$LOCK_NB = 4;
$LOCK_UN = 8;

sub lock_database
{     dbmopen (%STAFF, "$base/database/staff", 0644) || die "Can't open:
$!";
       flock STAFF, $LOCK_EX;
}

sub unlock_database
{     flock STAFF, $LOCK_UN;
      dbmclose (%STAFF);
}

Thanks for you help,

Greg Coit
gbc1@axe.humboldt.edu



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

Date: 13 Jan 1999 02:14:51 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Greg Coit <gbc1@axe.humboldt.edu>
Subject: Re: flock and dbmopen?
Message-Id: <m37lus55ys.fsf@joshua.panix.com>

Greg Coit <gbc1@axe.humboldt.edu> writes:

> After searching all the info I could find regarding flock, I'm
> starting to come to the conclusion there is no easy way to do this
> without tie (not that there is anything wrong with tie, I've just
> never used it before).

FWIW, I'd say bite the bullet and learn tie(), which is truly no more
complicated than dbmopen(), and is *way* more flexible.

>        flock STAFF, $LOCK_EX;

Or die, my friend.  Or die.

> {     flock STAFF, $LOCK_UN;

Never, never, never!  Just closing a file unlocks it safely.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Tue, 12 Jan 1999 17:06:31 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: flock and dbmopen?
Message-Id: <MPG.11059176139672e3989683@nntp1.ba.best.com>

In article <369BE9D9.4595151@axe.humboldt.edu>, gbc1@axe.humboldt.edu 
says...
> Hello folks,
> 
> I've been trying to lock a db file after opening it with dbmopen (not
> sure which flavor, NDBM, SDBM, or ?) without any luck.

There's an example of locking in the DB_File.pm docs.  But what I've been 
doing is just using a lockfile instead of trying to lock the actual 
database file.  As long as all my programs that access the dbm use the 
same lock file it seems to work fine.

> sub unlock_database
> {     flock STAFF, $LOCK_UN;
>       dbmclose (%STAFF);

I don't think you want to unlock a file before closing it.  Just close 
the file.

-- 
Bill Moseley mailto:moseley@best.com


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

Date: Tue, 12 Jan 1999 22:44:23 +0100
From: Per Kistler <kistler@gmx.net>
To: Dan Wedeking <wedeking@msw0.attnet.or.jp>
Subject: Re: how can I redirect the standard input to a file?
Message-Id: <369BC237.9930A96@gmx.net>

It should work, but check for file opening errors and 
flush handles, for testing. On Linux it works, without
extra flushing.

open(FILE, ">>log.txt") or die "Could not open file: $!";
select FILE;  $| = 1;
select STDIN; $| = 1;
while(<STDIN>) {
    print FILE;
}                


Per.

Dan Wedeking wrote:
> 
> I tried the below but it doesn't work?  Why?  If I take out the open command
> and the
> file handle "FILE" then it prints what I type to the screen a second time
> when I hit the
> enter key.  Why will this not be directed to append to the file "log.txt"???
> 
> open(FILE, ">>log.txt");
> while(<STDIN>) {
> print FILE;
> }
> 
> Dan
> }

-- 
Per Kistler kistler@gmx.net
------------------------------------------------------------


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

Date: 13 Jan 1999 00:40:17 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: How to stop perldoc scroll on find?
Message-Id: <77gq1h$kae@bgtnsc03.worldnet.att.net>

>Your DOS system must be different from mine.


So different, they had to call it UNIX. :)

CT




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

Date: 13 Jan 1999 01:50:55 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: How to stop perldoc scroll on find?
Message-Id: <77gu5v$o5$0@206.165.146.28>

Charles R. Thompson wrote in message <77gq1h$kae@bgtnsc03.worldnet.att.net>...
|>Your DOS system must be different from mine.
|So different, they had to call it UNIX. :)


Hey, I chastised myself for my egregious behavior within 10 min. of my
original post.  I don't you need getting on my case too <g>.  Mea culpa, I was
wrong, my apologies.  I have been toiling in the gulag that is MS so long that
I have no perspective.  Someday I hope to be redeemed.  Well one possible
source of redemption is that my solution actually works, and hopefully may be
of some small succor to other POBs.  I can only hope.

AmD





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

Date: Wed, 13 Jan 1999 00:15:51 GMT
From: birgitt@my-dejanews.com
Subject: Re: I don't know ANYTHING
Message-Id: <77gojg$dq6$1@nnrp1.dejanews.com>

In article <779pk6$e52@bgtnsc03.worldnet.att.net>,
  "Charles R. Thompson" <design@raincloud-studios.com> wrote:
> >Being a newbie myself, I suggest that you learn some basic
> programming in C
> >or Pascal before tackling Perl.
>
> C is a tackle, Perl is like Waltzing... with large German
> women.. but it is still Waltzing.
          ^^^

uuhhmm - first Waltzing, then even with German women and then a ...but...
and I thought I would be a happy German-woman-camper now.

> C makes me feel like I'm in a
> constant fistfight. Perl feels like a discussion.

You get into discussion while dancing the Waltzer, with large German women ?
Aahh, now I gotcha...something must be wrong with your Perl syntax then... :-)

C before Perl, Pascal before C, Programming before anything, so you can dance
the Tango in Perl. All was discussed here before. Larry Wall answered once
that no specific programming language is better suited to be learned before
learning Perl. Almost any serious person here will tell you to learn
programming first. (As they told me). For more on this use dejanews spring
1998 "First language".

B.Funk

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 13 Jan 1999 00:11:46 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Ignoring Comments while Parsing C/C++ Header Files
Message-Id: <77goc2$2hf$1@client2.news.psi.net>

gip (gibsonc@aztec.asu.edu) wrote on MCMLX September MCMXCIII in
<URL:news:77gjqn$pen@bmw.hwcae.az.Honeywell.COM>:
[] Does someone have an example of parsing a C/C++ header file where C and C++
[] style comments are ignored?

You might want to look into Mastering Regular Expressions which
has regexes for deleting comments.



Abigail


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

Date: 13 Jan 1999 00:52:52 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Ignoring Comments while Parsing C/C++ Header Files
Message-Id: <77gqp4$219$1@news.NERO.NET>

In article <77gjqn$pen@bmw.hwcae.az.Honeywell.COM>,
gip <gibsonc@aztec.asu.edu> wrote:
>Does someone have an example of parsing a C/C++ header file where C and C++
>style comments are ignored?

cc -E file.h > outputfile



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

Date: Tue, 12 Jan 1999 19:11:01 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Merging multiple files together........
Message-Id: <5rrg77.fo1.ln@magna.metronet.com>

Dee (darrick@2unreal.com) wrote:
:     I have a situation were I have many text files that contain
: information in the following format:
:         date time firstname lastname address city state zip
: I would like to create a perl script (because I was informed that it
: would be the best scripting language for this task) that would open up
: multiple text files and merger all of the data contained within these
: files into one file. I would like for the finished data to be arranged
: by date then time then finally by lastname.


   You have not told us how do identify the fields, which we must
   be able to do for the sorting part.

   Are they fixed width?

   Separated with some character?


   You have also not told us the format for the date and time,
   which we must know in order to devise a sort that will work.


:     I never created a program in my life and I would just like to know
: how difficult this would be to accomplish.


   It will be impossible to accomplish until more info is given.

   It is pretty simple if we had some sample data to work 
   with (hint, hint).

   Show us a few lines to be merged and sorted, and I'm sure
   someone will help you out.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 12 Jan 1999 18:00:39 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: newsgroups - CGI specific? (WAS: Re: help)
Message-Id: <369BE227.F9A99519@us.ibm.com>

Gala Grant wrote:
> 
> I know that this isn't the place to post CGI questions, but I don't know
> where that place is.  Can anyone help me?

You really should pick a better subject.  "help" is completely
worthless, and  makes it less likely that your question will get
answered.

Go to Dejanews.  Use their power search function.  Try *cgi* for a forum
name (Include the *'s).  Choose a language if you desire.  Click find. 
See what comes up.

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: 13 Jan 1999 00:52:05 GMT
From: julianje@mercury.interpath.com (Jere Julian - Personal Account)
Subject: Re: NT User Admin Script
Message-Id: <77gqnl$cid$1@gaddy.interpath.net>

Gareth Jones (gareth@ibis.demon.co.uk) wrote:
: lchuck@home.com wrote:

: O'Reilly's book on NT User Administration is pretty good for this and
: has a high perl content. If you don't want to get the book, at least
: go to the O'Reilly website, look up the book, and click on the
: examples link - you'll be able to download some sample scripts that
: should get you started.

: Gareth 

The problem here is that these scripts don't work under current Activestate
Perl.  I am in the same predicament.  Does anyone have Activestate Perl Build
306?  That's the last one the O'Reilly worked in.  Please help...

-Jere
mailto:jjulian@laddnet.com



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

Date: Tue, 12 Jan 1999 17:07:56 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: paragraphs
Message-Id: <ckkg77.8v.ln@magna.metronet.com>

_cim_ (cim@online.ee) wrote:
: I have a txt file with multiple lines - 12 paragraphs separated by
: empty lines.
: I open this file.

: Now i need get those paragraphs separately. How can i do it. I can put
: special markers at the beginning and end of each paragraph. I need to
: do it fast. Which method would be the best.


  Use paragraph mode.

  It uses blank lines to mark the end of a "chunk", so you
  don't have to change your data:


   {  local $/ = '';  # localize changes to Perl's special variables...
      while (<>) {
         # do something with each paragraph
      }
   }


  Look up the $/ special variable in perlvar.pod.



--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 12 Jan 1999 19:32:42 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: Perl Criticism
Message-Id: <39vhic3tcl.fsf@ibnets.com>


lowermind blathered:

  >> For example Perl has these stupeeds:
  >> 
  >> thisdate = `date`;
  >> 
  >> Perl put these things in purely for backward familiarity with
  >> Unix scripting.

  >> The backtics are WAY too easy to confuse with
  >> string quotes,

so perl (as usual) gives you more than one way to do it. try qx{}
instead if you want more visibility. write a sub to do it for you if you
want even more. don't burden the language with your narrow lowermind.

  DF(?tP>   dothis or die "I was unable to do this";

  DF(?tP> Looks almost like english doesn't it?

but we know lowestmind doesn't like english. too many choices. he
already chooses poorly in his posts so don't challenge him with
options. he want 'one true way' to do anything. mucho fun and creativity
there. how about english poetry but it must always rhyme with orange?

  >> Why not have a Pipe() or Exec() function instead of backtics?

so write your own godammit! perl is. your crap ain't nor will ever be.

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Tue, 12 Jan 1999 19:15:05 -0600
From: "Michael D. Schleif" <mds-resource@mediaone.net>
Subject: Re: Perl Criticism
Message-Id: <369BF399.CC35F708@mediaone.net>

Thank you, all for your kind responses to topmind's challenge.

My challenge was aimed at Mr.-Know-it-all, who conveniently deferred to
those in the know ;)

The point here is, *not* whether or not topmind's point is valid;
rather, whether or not the critic knows wherefrom he speaks.  If topmind
had been so kind as to use *working* code for his examples, much of the
flaming herein would never have occurred.

He didn't -- and I maintain that he *cannot* . . .

topmind@technologist.com wrote:
> 
> In article <slrn79ggu1.cjr.dformosa@godzilla.zeta.org.au>,
>   dformosa@zeta.org.au (David Formosa (aka ? the Platypus)) wrote:
> > >
> > >@_(-->$/(.)/up/Your*$s\\|>you&%!$@#crypt=++||#@tol<>>??logists!@#
> >
> > Thats not valid perl.
> 
> But I bet it is only a few keystrokes away from being runnable.

-- 

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . . "


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

Date: Tue, 12 Jan 1999 19:17:23 -0600
From: "Michael D. Schleif" <mds-resource@mediaone.net>
Subject: Re: Perl Criticism
Message-Id: <369BF423.F349B0EC@mediaone.net>

for (keys %liquour_cabinet) {
	open($_) or die;
}

I R A Aggie wrote:
> 
> ...and where the heck did I put it? Perhaps in %liquour_cabinet? where's
> the KEY! AAAAAIIIIIIIEEEEEEEEE

-- 

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . . "


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

Date: Tue, 12 Jan 1999 19:12:18 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl Criticism
Message-Id: <itrg77.fo1.ln@magna.metronet.com>

I R A Aggie (fl_aggie@thepentagon.com) wrote:
: In article <369B85F6.B68B0E1@mail.uca.edu>, Cameron Dorey
: <camerond@mail.uca.edu> wrote:

: + I thought that cartooning was done by computers now. I wonder which
: + brand does the drawing for Mr. Adams? 

: I think its the Adams Mk I, Rev 0.


   Bzzzzt.

   His name is Scott, not Mark,   heh, heh...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 13 Jan 1999 01:25:01 GMT
From: gbkr@worldnet.att.net (Gary Baker)
Subject: Perl Script wanted for possible profitable project
Message-Id: <369bf22f.117421365@netnews.worldnet.att.net>


Although I have read books on perl and have a Linux setup I am not a
perl programmer. I have written simple scripts but nothing as complex
as this and I believe that this is fairly simple. I need a script to
search the Internet by arguments, using  only two terms actually. The
searches would need to be performed on a listing of search engines and
the results would need to be written to a file. The file would then
need to be sorted in alphabetical order with duplicates discarded.

Any help would be greatly appreciated and if you are interested in
getting paid for the script email me with your price.

Thanks in advance.

Gary


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

Date: 13 Jan 1999 02:10:00 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Randal's code [was Re: How do I delete tmp files based on age?]
Message-Id: <m3aezo566v.fsf@joshua.panix.com>

merlyn@stonehenge.com (Randal L. Schwartz) writes:

> >>>>> "David" == David L Nicol <david@kasey.umkc.edu> writes:
> 
> David> What's wrong with just using "find" for this kind of thing?

> so, not much, but hey, we can do nearly all those steps in Perl...

Just recently I bought the O'Reilly bash book, and tried writing a few
utils in bash (the only shell I can get around in).  I could do it,
and would probably get better at it over time, but... geez... once you
can speak Perl, bash is like

 ...[searching for a metaphor]...

using MS notepad as a programmer's text editor.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf
Maybe that wasn't such a good metaphor.


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

Date: Wed, 13 Jan 1999 00:08:53 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: rounding
Message-Id: <369BE5E5.E4EDC440@home.com>

[posted & mailed]

Larry Rosler wrote:
> 
> sprintf('%d", ...) does the same thing as int(...), but why bother 
> with the slower way?

I'm not sure if the twenty lines of tildes was a hint or not but here
goes anyway.  :-)

#!/usr/local/bin/perl -w

use strict;
use Benchmark;

timethese 100000, {
        Ctrl    => sub {
            my $number = +8.99;
            my $integer = 8;
        },
        Int     => sub {
            my $number = +8.99;
            my $integer = int($number);
        },
        Sprintf => sub {
            my $number = +8.99;
            my $integer = sprintf("%d", $number);
        },
};

Benchmark: timing 100000 iterations of Ctrl, Int, Sprintf...
      Ctrl:  2 wallclock secs ( 0.71 usr +  0.00 sys =  0.71 CPU)
       Int:  1 wallclock secs ( 0.99 usr +  0.00 sys =  0.99 CPU)
   Sprintf:  0 wallclock secs ( 1.65 usr +  0.00 sys =  1.65 CPU)

YMMV.  HAND.

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Wed, 13 Jan 1999 01:14:29 GMT
From: dave.f.underwood@Vanderbilt.edu (Dave Underwood)
Subject: Simple Question lists of lists - please help!!
Message-Id: <369bf227.32562170@news.vanderbilt.edu>

I'm trying to do something really simple but can't.  I have a standard
txt file that when builds looks like: (pipe delimited)

a1|a2|a3|a4
aa1|aa2|aa3|aa4
aaa1|aaa2|aaa3|aaa4

what i need to do is have a script produce an html page which will
output the data as:

"Column One:"
a1
aa1
aaa1


"Column Two:"
a2
aa2
aaa2

"Column Three:"
a3
aa3
aaa3

etc. etc. Basically, I just need to group the individual column data
together!
Any help would be greatly apprecieated.

Thanks,

Dave Underwood
Vanderbilt University
dave.f.underwood@Vanderbilt.edu


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

Date: Mon, 11 Jan 1999 17:55:38 +0000
From: Brian McCauley <B.A.McCauley@bham.ac.uk>
Subject: Re: subroutine returning an lvalue
Message-Id: <u9k8ytzpkk.fsf@wcl-l.bham.ac.uk>

Brett Diamond <Brett.Diamond@lmco.com> writes:

> My problem is that the perl module already exists and is in production.
> I want to change the minimal amount of application code while adding
> functionality to the module for further implementations.  My module,
> which again looks nothing like my example, currently uses a scalar to
> store and retrieve a particular bit of information. I'd like to replace
> that with a subroutine call.

Herein lies the flaw in your logic.  The syntax of a method call, even
in an rvalue context is different from that of a member reference.
The lvalue question is moot.  Your tied variable solution is the only
way to go.

> I figured that since I can create subroutines that act as lvalues in C++
> and Perl is much better that C++ in most respects, there must be a way to
> do this in Perl.  I suspect, however, that Perl cannot (yet).

Again your logic is flawed.  If you want foo()=1; in C++ do anything
non-trivial with the value 1 then foo() must return a refernce to an
object of a class that overloads the assignment operator.  The only
way to overload the assignment operator in Perl is to use a tied
thingy.  So even if Perl functions could return lvalues you'd still
need to use a tied scalar.

-- 
     \\   ( )  No male bovine  | Email: B.A.McCauley@bham.ac.uk
  .  _\\__[oo   faeces from    | Phones: +44 121 471 3789 (home)
 .__/  \\ /\@  /~)  /~[   /\/[ |   +44 121 627 2173 (voice) 2175 (fax)
 .  l___\\    /~~) /~~[  /   [ | PGP-fp: D7 03 2A 4B D8 3A 05 37...
  # ll  l\\  ~~~~ ~   ~ ~    ~ | http://www.wcl.bham.ac.uk/~bam/
 ###LL  LL\\ (Brian McCauley)  |


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

Date: Tue, 12 Jan 1999 22:36:45 +0100
From: Per Kistler <kistler@gmx.net>
To: "M. Morgan" <mmorgan@gladstone.uoregon.edu>
Subject: Re: substituting an exact negated string: can I?
Message-Id: <369BC06D.75ECD710@gmx.net>

#!/usr/bin/perl

require 5.003;
use strict;

my $yes = qq(blah <img src="http://kistler.discordia.ch/x.jpg"> blah);
my $no  = qq(blah <a href="http://kistler.discordia.ch/">Unix</a> blah);

for my $try ( $yes, $no ){
        $try =~ s(<(?!a href|/a).*?>)
                 ( "removed here" )gi;
        print $try,"\n";
}
              

Per.


> I want to get rid of anything between < and > from form data unless it is a
> hyperlink.

> I want to change the line:  $value =~ s/<!--(.|\n)*-->//g; (shown by
> asterisks) to something like the following:
> 
> $value =~ s/<[^a href]*?>//gi;
> 
> -Mike Morgan

-- 
Per Kistler kistler@gmx.net
------------------------------------------------------------


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

Date: Wed, 13 Jan 1999 01:25:29 -0000
From: "Peter Morrow" <morrowp@tcd.ie>
Subject: Using require command
Message-Id: <77gsfa$7e9$1@news.indigo.ie>

I'm trying to learn Perl at the moment to use in part of my final year
project. One problem I've had is that the require command wont work. When I
check the file in dos I get an message saying <filename required>.pl did not
return a true value at <file in which program is running>.pl  line x.
The required file which contains subroutines seems to compile fine and the
code within it will work if placed within the file where the program is
running.
The required file is in the same folder as the file that is trying to run so
thats not the problem.

Any ideas?


Peter Morrow





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

Date: Tue, 12 Jan 1999 17:52:01 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Peter Morrow <morrowp@tcd.ie>
Subject: Re: Using require command
Message-Id: <369BFC41.596A7DC7@atrieva.com>

You did read the documentation, right?

perldoc -f require

[snip]

The file must return TRUE as the last statement to indicate successful
execution of any initialization code, so it's customary to end such a
file with `` 1;'' unless you're sure it'll return TRUE otherwise.  But
it's better just to put the ``1;'', in case you add more statements. 

[/snip]

If you are just learning perl, the first thing you shoule learn is that
it comes complete with thousands of pages of documentation.  Every
function is described in full. 

You can access these pages with the perldoc tool, or install them on a
web server and access them through your browser.

Good Luck!

Peter Morrow wrote:
> 
> I'm trying to learn Perl at the moment to use in part of my final year
> project. One problem I've had is that the require command wont work. When I
> check the file in dos I get an message saying <filename required>.pl did not
> return a true value at <file in which program is running>.pl  line x.
> The required file which contains subroutines seems to compile fine and the
> code within it will work if placed within the file where the program is
> running.
> The required file is in the same folder as the file that is trying to run so
> thats not the problem.
> 
> Any ideas?
> 
> Peter Morrow

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: 12 Jan 1999 19:37:08 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: Verify an email address
Message-Id: <39u2xw3t57.fsf@ibnets.com>

>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:

  RLS> I was only half joking when I said "if it's not in the CPAN, it
  RLS> doesn't exist".

but randal, you are not in CPAN, so do you exist? do any of us really
exist? are we in the hash of life?

	exists( $life{$i} ) && $i = $think ;

(that does't translate descartes properly so consider it perl poetry)

:-)

uri


-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: 13 Jan 1999 00:45:48 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Verify an email address
Message-Id: <77gqbs$1qv$1@news.NERO.NET>

In article <m1hftw89e2.fsf@halfdome.holdit.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>If it's not in the CPAN, it doesn't exist.

So, all the modules that are stored on CPAN were written to be used in
software that doesn't exist? It seems an incredible waste of effort.



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

Date: 13 Jan 1999 01:55:03 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Uri Guttman <uri@ibnets.com>
Subject: Re: Verify an email address
Message-Id: <m3d84k56vs.fsf@joshua.panix.com>

Uri Guttman <uri@ibnets.com> writes:

> >>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:
> 
>   RLS> I was only half joking when I said "if it's not in the CPAN, it
>   RLS> doesn't exist".
> 
> but randal, you are not in CPAN, so do you exist?

On the contrary!

    cpan> a /randal/
    Author id = MERLYN
	EMAIL        merlyn@stonehenge.com
	FULLNAME     Randal L. Schwartz

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: 12 Jan 1999 19:58:04 -0500
From: Uri Guttman <uri@ibnets.com>
To: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Verify an email address
Message-Id: <39ogo43s6b.fsf@ibnets.com>

>>>>> "JF" == Jonathan Feinberg <jdf@pobox.com> writes:

  JF> Uri Guttman <uri@ibnets.com> writes:
  >> >>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:
  >> 
  RLS> I was only half joking when I said "if it's not in the CPAN, it
  RLS> doesn't exist".
  >> 
  >> but randal, you are not in CPAN, so do you exist?

  JF> On the contrary!

  cpan> a /randal/
  JF>     Author id = MERLYN
  JF> 	EMAIL        merlyn@stonehenge.com
  JF> 	FULLNAME     Randal L. Schwartz

but that is only a CPAN shell of him. the one and only true randal
drinks beer and plays action video games. try that on CPAN.

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Wed, 13 Jan 1999 00:28:42 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: white paper on how Perl interpreter works or designed ?
Message-Id: <slrn79nq6r.cl.alastair@calliope.demon.co.uk>

Yao Xu <dy257@cleveland.Freenet.Edu> wrote:
>
>Guys, 
>
>
>are there any white papers on how Perl interpreter 
>works and is designed ? 

Might not be exactly what you want  ;

perldoc perlguts

and at http://conference.perl.com/

path ;

fullpapers/Perl_Language_and_Modules/Perl%20Illustrated/

HTH.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 V8 Issue 4634
**************************************

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