[19730] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1925 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 14 03:05:31 2001

Date: Sun, 14 Oct 2001 00:05:08 -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: <1003043108-v10-i1925@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 14 Oct 2001     Volume: 10 Number: 1925

Today's topics:
    Re: 20-line webserver in perl ? <pne-news-20011014@newton.digitalspace.net>
        ANNOUNCE: Class::Delegation 1.00 (Damian Conway)
    Re: Code protection (Chris Fedde)
    Re: extracting strings from variable length lines <goldbb2@earthlink.net>
    Re: Follow up: Match Operator not working? <goldbb2@earthlink.net>
    Re: How do you get paid for Perl work over the Internet <matthew.garrish@sympatico.ca>
    Re: How do you get paid for Perl work over the Internet <aperlprogrammer@yahoo.com>
    Re: How do you get paid for Perl work over the Internet <tim@vegeta.ath.cx>
    Re: How to stop File Upload (CGI) <goldbb2@earthlink.net>
        HTML output using perl... <fail006@hotmail.com>
    Re: HTML output using perl... <tintin@snowy.calculus>
    Re: HTML output using perl... <rob_13@excite.com>
    Re: HTML output using perl... <tim@vegeta.ath.cx>
    Re: Need help with a Regular Expression <goldbb2@earthlink.net>
        newbie for perl <newbie_member@newsguy.com>
    Re: Parsing complex data structure <goldbb2@earthlink.net>
    Re: Parsing complex data structure <thelma@alpha2.csd.uwm.edu>
    Re: PERL freelance programmer availeable <james@zephyr.org.uk>
    Re: PERL freelance programmer availeable (Randal L. Schwartz)
    Re: PERL freelance programmer availeable <dha@panix.com>
        regular expression <yah00204052@yahoo.com>
    Re: regular expression <tony_curtis32@yahoo.com>
    Re: regular expression <jeff@vpservices.com>
    Re: regular expression <jurgenex@hotmail.com>
    Re: regular expression <yah00204052@yahoo.com>
    Re: regular expression <jeff@vpservices.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 14 Oct 2001 09:00:30 +0200
From: Philip Newton <pne-news-20011014@newton.digitalspace.net>
Subject: Re: 20-line webserver in perl ?
Message-Id: <svdistspomgkgrja07vdekja04dl19l6ug@4ax.com>

On 13 Oct 2001 12:45:57 -0400, Joe Schaefer <joe+usenet@sunstarsys.com>
wrote:

> Besides, you can cram an awful lot of stuff in 4 lines of Perl :)

and then sigged:

> -- 
> $v="HTTP/1.0";$/="\r\n"x2;socket S,2,1,6;bind(S,pack'Snx12',2,80)||die;listen S
> ,8;for(*STDOUT=*C;accept(C,S);close){($_)=<C>=~/^GET\s+(\S+)/ or print("$v 400"
> .$/),next;$ENV{QUERY_STRING}=s/\?(.+)//?$1:'';s/%(..)/chr hex$1/eg;-x$_?print(
> "$v 200$/")&&do$_:open(F,$_)?print"$v 200$/",<F>:print"$v 404$/"for$ARGV[0].$_}

That doesn't mean you should :)

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 14 Oct 2001 06:09:33 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Class::Delegation 1.00
Message-Id: <9qba6s$itv$1@towncrier.cc.monash.edu.au>
Keywords: perl, module, release

==============================================================================
                 Release of version 1.00 of Class::Delegation
==============================================================================


NAME
    Class::Delegation - Object-oriented delegation

DESCRIPTION
    The Class::Delegation module simplifies the creation of delegation-based
    class hierarchies, allowing a method to be redispatched:
	    * to a single nominated attribute,
	    * to a collection of nominated attributes in parallel, or
	    * to any attribute that can handle the message.

    These three delegation mechanisms can be specified for:
	    * a single method
	    * a set of nominated methods collectively
	    * any as-yet-undelegated methods
	    * all methods, delegated or not.

AUTHOR
    Damian Conway (damian@conway.org)

COPYRIGHT
           Copyright (c) 2001, Damian Conway. All Rights Reserved.
        This module is free software. It may be used, redistributed
            and/or modified under the same terms as Perl itself.


==============================================================================

CHANGES IN VERSION 1.00

(No changes have been documented for this version)

==============================================================================

AVAILABILITY

Class::Delegation has been uploaded to the CPAN
and is also available from:

	http://www.csse.monash.edu.au/~damian/CPAN/Class-Delegation.tar.gz

==============================================================================


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

Date: Sun, 14 Oct 2001 05:10:57 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Code protection
Message-Id: <B79y7.97$oe8.188195328@news.frii.net>

In article <18Kx7.120397$W8.2839964@bgtnsc04-news.ops.worldnet.att.net>,
Tim from AZ <tim_odomNOSPAM@NOSPAMhotmail.com> wrote:
>Has anyone here had any success in using a tracking system with their perl
>programs to keep them from unauthorized resale?  In particular I'm thinking
>of keeping a database on my web server  that contains a list of authorized
>sites.  If the referrer url doesn't match up with one in the database, it
>will simply cause the script not to work.  I realize that this is not
>foolproof, but the point is to make it difficult to use without proper
>authorization, not impossible.  I would also encrypt the code.  Any
>ideas/suggestions/comments about such a system?
>
>

If your system is so valuable that you need to insure this level
of compliance with your license agreements then you should be
looking at the hardware dongles such as are hung off the printer
port or some kind of printed license key needed to run the code.
If you want to encrypt your code look at the perlfilter manual
page.   Tying these two techniques together is bound to keep your
code from being improperly used. Heck it might keep your code from
being used at all which would surely be better than being used
wrong.

Good Luck
-- 
    This space intentionally left blank


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

Date: Sat, 13 Oct 2001 21:56:17 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: extracting strings from variable length lines
Message-Id: <3BC8F0C1.6C5728B5@earthlink.net>

hugo wrote:
> 
> Hi
> 
> I would like to extract individual strings (words) from lines in a
> file, the moment several lines have the same length (i.e. contain the
> same number of words, delimited by whitespace). How do I do this?
[snip]
> But how do I store the separate strings in an array, if beforehand I
> do not know how long the line will be i.e how many words it will
> contain?

I will assume that you intend to put each line into a group depending on
how many words are in it.

Here's some methods which will do it:

my @group_by_count;
while( <> ) {
    my @words = split;
    my $words_count = @words;
    push @{$group_by_count[$words_count]} => $_;
}

my @group_by_count;
while( <> ) {
    my $words_count = (() = split ' ', $_, -1);
    push @{$group_by_count[$words_count]} => $_;
}

my @group_by_count;
while( <> ) {
    my $words_count = (() = m/\S+/g);
    push @{$group_by_count[$words_count]} => $_;
}

my @group_by_count;
push @{$group_by_count[() = m/\S+/g]} => $_ while <>;

NB: None of these are tested.

-- 
    "Just how stupid are you Kuno?"
    "Verily, Tatewaki Kuno knows no limits."


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

Date: Sat, 13 Oct 2001 21:34:59 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Follow up: Match Operator not working?
Message-Id: <3BC8EBC3.C466DF30@earthlink.net>

Roy wrote:
> 
> Ok, here's the code I'm having problems with.  When &verinfo is
> executed, $current_line has nothing but a return char in it.  But
> &rptinfo works fine. It would *seem* that $current_line lost it's
> value the first time around...
> 
> Any ideas?

Yeah.  Rewrite your code.  The logic stinks, and you shouldn't ever be
using eval... there's almost always another way to do it.

#!/usr/bin/perl -w

open( ADUIRV, "<adu-fit.txt" )
    or die "Couldn't open adu-fit.txt for reading: $!";
read( ADUIRV, $_, -s ADUIRV ) == -s _
    or die "Couldn't read adu-fit.txt: $!";
close ADUIRV
    or die "Error closing file adu-fit.txt: $!";

print "ADU Reader results:\n";
print m[^(Date:.*)]m, "\n";
print m[^(Time:.*)]m, "\n";
print m[^(Computer.*)]m, "\n";
print m[^(System ROM.*)]m, "\n";
print m[^Array .* Version ([\d.]+)]m, "\n";

__END__

See?  Isn't that simple?
NB: The above code is untested.

-- 
    "Just how stupid are you Kuno?"
    "Verily, Tatewaki Kuno knows no limits."


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

Date: Sat, 13 Oct 2001 23:32:25 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: How do you get paid for Perl work over the Internet??
Message-Id: <zH7y7.46011$dO3.4345698@news20.bellglobal.com>


"Carlos C. Gonzalez" <aperlprogrammer@yahoo.com> wrote in message
news:MPG.16324c32d15dc0369897b0@news.edmonton.telusplanet.net...
>
> I do the marketing.  I sell the product.  New programmers get to do the
> work.  I would hand off the client to a new programmer lock, stock, and
> barrel.  Getting a small commission only on work that I could not handle
> myself.  Timewise.  I will undoubtedly get more work than I can
> handle eventually and I don't want to just drop potential clients without
> making something in return for my efforts in getting them.
>

Wow! You must be the only person on the planet who hasn't noticed that the
tech market is in the can. I'd love to know what 'mom and pop' operations
are scrambling to get a web presence, and better yet, would need a perl
programmer.

More to the point, however, do you know what the penalties for
misrepresentation are? You are going to enter a contract with a client to
provide them with sub-par programmers who will hopefully be able to do what
they need. Wiping your hands clean and saying you are just a middle-man will
not get you off the hook when the client demands to be compensated for the
inevitable crap. As you've noted, this will be subcontracted work, and as
the person doing the subcontracting, you are liable for ensuring the quality
of the said work. It sounds like you've been reading too many of those
get-rich-quick schemes that come in your email. I wouldn't recommend
barrelling headlong into a field you don't seem to know too much about, but
to each his own...

Matt





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

Date: Sun, 14 Oct 2001 06:19:21 GMT
From: Carlos C. Gonzalez <aperlprogrammer@yahoo.com>
Subject: Re: How do you get paid for Perl work over the Internet??
Message-Id: <MPG.1632dbdf16a8a5d49897b2@news.edmonton.telusplanet.net>

Matt Garrish at matthew.garrish@sympatico.ca said...

> Wow! You must be the only person on the planet who hasn't noticed that the
> tech market is in the can. 

Hi Matt.  I noticed what you are talking about Matt but it doesn't faze 
me.  As long as there are people wanting to get on the Internet to make 
extra money there will be a need for Perl programmers and web page 
developers.  

> I'd love to know what 'mom and pop' operations
> are scrambling to get a web presence, and better yet, would need a perl
> programmer.

There are tons of people wanting to establish a web presence Matt.  Tons!  
I know of several people in my locale who are very interested in this.  
One friend of mine is too busy with a daily job to develop his own 
Internet presence so he is paying a web designer to do it for him (I 
didn't know him until after he was in mid-stream with someone else).  
Another - an electrician - wants to develop an Internet presence for his 
business.  A third talked about his dream of getting on the Internet.  
Still another friend has developed a 500 page site (literally) of 
building contractors and suppliers and needs some work done on it.  I 
haven't even looked for or marketed to these people Matt. They are all 
over the place and have just popped out with their Internet interests as 
they have found out what I am doing.  

Their ideas may or may not be solid but they are all willing to put money 
down to have them become reality.  

And every one of them is in need or will be of something that Perl can do 
for them.  Like backend database solutions using MySQL to name one.  

If you are talking about dot coms and other high tech business interests 
you are probably right.  There aren't many "scrambling to get a web 
presence".  But the average person sees the Internet as a great 
opportunity and wants to get on it.  Often times they don't know how and 
need someone to show them.  And yes they will pay to get help but not in 
the $100.00 an hour range.  

So as far as the tech market being in the dumps?  I would rather it 
weren't but frankly it's not going to affect my bottom line marketing to 
the people that want and need my help.  The little guy (or gal).  

And they don't just need Perl programming Matt but a whole slew of 
related things.  The trick is to provide Perl programming but not to 
limit ourselves to just that.  But to provide as much of what they need 
as we can and as they are willing to pay us to do.  

Oh well there is just simply too much to go into here.  I guess I better 
quit this topic before I get flamed for being off-topic (even though I am 
talking about Perl programming - at least about making some kind of 
living from it).  

Have a good one. Again thanks to those of you that responded either by 
email or here.  I will try to restrain myself from responding further in 
this thread *grin* unless I am emailed of course.  

---
Carlos 
www.internetsuccess.ca (not operational yet)


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

Date: Sun, 14 Oct 2001 06:43:05 GMT
From: Tim Hammerquist <tim@vegeta.ath.cx>
Subject: Re: How do you get paid for Perl work over the Internet??
Message-Id: <slrn9sidr1.1dv.tim@vegeta.ath.cx>

Me parece que Carlos C Gonzalez <aperlprogrammer@yahoo.com> dijo:
[ snip ]
>  But the average person sees the Internet as a great 
>  opportunity and wants to get on it.  Often times they don't know how and 
>  need someone to show them.  And yes they will pay to get help but not in 
>  the $100.00 an hour range.  

*yay!*

I'm so glad the "average person" has you to hold their hand and tell
them what they want.  That, as opposed to your other ideas, is a proven
method.  Micro$oft wouldn't have gotten where it is if it hadn't told
millions of Americans exactly what they want.

(occurs to me how, whenever there is a serious flaw in a Windows
release, third party software is released to fix it, usually from
Norton, McAfee, or sometimes ZDnet.  This same "patch" is then released
with the _following_ Windoze OS. All those millions of dollars and no
one in Redmond has much foresight.)

[ snip ]
>  And they don't just need Perl programming Matt but a whole slew of 
>  related things.  The trick is to provide Perl programming but not to 
>  limit ourselves to just that.  But to provide as much of what they need 
>  as we can and as they are willing to pay us to do.  

Priceline had that same philosophy.  They overextended themselves and
lost millions of $$.

>  Oh well there is just simply too much to go into here.  I guess I better 
>  quit this topic before I get flamed for being off-topic (even though I am 
>  talking about Perl programming - at least about making some kind of 
>  living from it).  

Another oversight.  This is a NG for discussion of the _language_ of
Perl...not it's economic or corporate implications.  Haven't you noticed
others being flamed for posting jobs and resumes?  If you want to know
what's wrong with your perl code, check the docs, then post.  If you
have a great business idea, sell it to Grand Rapids, MI.

[ snip ]

>  Have a good one. Again thanks to those of you that responded either by 
>  email or here.

No problem. =)

Tim

-- 
In 1968 it took the computing power of 2 C-64's to fly a rocket to the moon.
Now, in 1998 it takes the Power of a Pentium 200 to run Microsoft Windows 98.
Something must have gone wrong.


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

Date: Sat, 13 Oct 2001 22:16:08 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: How to stop File Upload (CGI)
Message-Id: <3BC8F568.7B0C4A49@earthlink.net>

Petar Markovic wrote:
> 
> Hi,
> 
> I an making CGI scripts for uploading files.
> It is designed for business clients and some of them need to upload
> large files.
> 
> If a client pushes the Stop button on the browser I want the upload to
> stop and delete the part of file already copied to Server.

If that's what you want, you'll have to parse the CGI stuff yourself,
and not use CGI.pm.  You should probably be able to take cgi-lib.pl and
modify it to suit your needs.

The reason for this is that CGI.pm will first read the uploaded file
from STDIN and store it in a file, and then give you an open file handle
with which to read that file.  So by the time you're reading from the
handle, it's a perfectly oridinary file-- you're not reading it from
STDIN or wherever.

-- 
    "Just how stupid are you Kuno?"
    "Verily, Tatewaki Kuno knows no limits."


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

Date: Sun, 14 Oct 2001 15:41:18 +1300
From: "fail006" <fail006@hotmail.com>
Subject: HTML output using perl...
Message-Id: <9qatj1$be6$1@lust.ihug.co.nz>

Hi,
I have recently started using perl. I am know most of the basics about perl
now. I would like to know how can i make perl output in to html format. I
have found loys of scripts on the web, but haven't found the steps that i
should run the script, to give me html output.
I currently use MS win 98 to do all my perl programming.
When i run the example code, it just outputs everything to MS DOS command
window...
What do i require to setup so that i can perl to output as html...

Thanks in advance.....





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

Date: Sun, 14 Oct 2001 13:32:46 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: HTML output using perl...
Message-Id: <FI7y7.13$kk6.112751@news.interact.net.au>


"fail006" <fail006@hotmail.com> wrote in message
news:9qatj1$be6$1@lust.ihug.co.nz...
> Hi,
> I have recently started using perl. I am know most of the basics about
perl
> now. I would like to know how can i make perl output in to html format. I
> have found loys of scripts on the web, but haven't found the steps that i
> should run the script, to give me html output.
> I currently use MS win 98 to do all my perl programming.
> When i run the example code, it just outputs everything to MS DOS command
> window...
> What do i require to setup so that i can perl to output as html...

Your question really is, "How do I run CGI scripts?"

First install a web server on your PC (apache is very popular), then read
the CGI.pm manual.




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

Date: Sun, 14 Oct 2001 03:36:24 GMT
From: "Rob - Rock13.com" <rob_13@excite.com>
Subject: Re: HTML output using perl...
Message-Id: <Xns9139F002D7555rock13com@64.8.1.226>

fail006 <news:9qatj1$be6$1@lust.ihug.co.nz>:

> I have recently started using perl. I would like to know how
> can i make perl output in to html format. When i run the
> example code, it just outputs everything to MS DOS command
> window... 

That is HTML. You need to use some program to view it as HTML if 
you want.

> What do i require to setup so that i can perl to output as
> html... 

I suppose you want to get a server, such as Apache, then configure 
it to use Perl for CGI (simple, read the instructions--actually the 
installer for Apache may do this for you on Win32).

Now call your perl script as a CGI application (or use the one 
below). Standard output is your browser and it will render HTML if 
you tell it so with a content-type: text/html.


#!c:/perl/bin/perl
print "content-type: text/html\n\n";
print "<h1>Howdy!</h1>";

# Forgive the incompleteness of the HTML document here.

-- 
Rob - http://rock13.com/
Web Stuff: http://rock13.com/webhelp/


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

Date: Sun, 14 Oct 2001 05:41:21 GMT
From: Tim Hammerquist <tim@vegeta.ath.cx>
Subject: Re: HTML output using perl...
Message-Id: <slrn9sia7a.sv.tim@vegeta.ath.cx>

Me parece que Rob - Rock13.com <rob_13@excite.com> dijo:
>  fail006 <news:9qatj1$be6$1@lust.ihug.co.nz>:
> > I have recently started using perl. I would like to know how
> > can i make perl output in to html format. When i run the
> > example code, it just outputs everything to MS DOS command
> > window... 
>  
>  That is HTML. You need to use some program to view it as HTML if 
>  you want.

Well, he did say HTML in the title, and I award 50 bonus points for not
using 'PERL' at all.  ;)

[ snippage ]

Tim Hammerquist
-- 
Woman on Street:   Sir, you are drunk; very very drunk.
Winston Churchill: Madame, you are ugly; very, very ugly.
                   I shall be sober in the morning.


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

Date: Sat, 13 Oct 2001 21:42:21 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Need help with a Regular Expression
Message-Id: <3BC8ED7D.3D8C9600@earthlink.net>

2obvious wrote:
[snip]
> So I decided to use John's expression:
> 
> /^[A-Z]+(\s[A-Z]+)+$/i

This can be made slightly faster by changing those parens to the
non-capturing type:

  /^[A-Z]+(?:\s[A-Z]+)+$/i

-- 
    "Just how stupid are you Kuno?"
    "Verily, Tatewaki Kuno knows no limits."


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

Date: 13 Oct 2001 22:46:22 -0700
From: newbie <newbie_member@newsguy.com>
Subject: newbie for perl
Message-Id: <9qb8re02sof@drn.newsguy.com>

Hi all:

I downloaded perl 5.6.1 source code from perl.org on my solaris 7 (x86) and
tried to compile it. From the doc "INSTALL", it is quite simple:

The basic steps to build and install perl5 on a Unix system
with all the defaults are:

        rm -f config.sh Policy.sh
        sh Configure -de
        make
        make test
        make install

        # You may also wish to add these:
        (cd /usr/include && h2ph *.h sys/*.h)
        (installhtml --help)
        (cd pod && make tex  && <process the latex files>)

Each of these is explained in further detail below.


but I encountered strange error messages after I followed the steps

hostname:~/src/p561$ sh Configure -de
Configure: ^M: not found
Configure: ^M: not found
Configure: ^M: not found
Configure: ^M: not found
: No such file or directory
Configure: ^M: not found
Configure: ^M: not found
Configure: ^M: not found
Configure: ^M: not found
: No such file or directory
Configure: ^M: not found
Configure: ^M: not found
Configure: ^M: not found
Configure: ^M: not found
: No such file or directory
Configure: ^M: not found
Configure: ^M: not found
Configure: ^M: not found
Configure: ^M: not found


Could anyone help me on this?

Thanks in advance

_newbie



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

Date: Sat, 13 Oct 2001 22:36:19 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Parsing complex data structure
Message-Id: <3BC8FA23.EA4BFE94@earthlink.net>

Drew Myers wrote:
> 
> Hi.
> 
> I have two data structures, one is a simple hash, the other is a bit
> more complex (actually, there are several more, but I'm only
> interested in these two for the time being).
> 
> My goal, is to print out the information from the complex data
> structure, if the key exists in the second (simple) hash.
> 
> The print statement at the end is not iterating through the record the
> way I think it should.  I do get the proper quantity of lines printed,
> but the information is always the first element (I assume) of the
> record.
> 
> #!/c/perl/bin/perl -w
> use strict;
> use Net::FTP;
> 
> # Fetch list of servers
> # Build record for each server
> 
> my @cons=qw(/etc/passwd /etc/shadow /etc/security/passwd);
> my $record;
> my $server;
> my $dir=qw(c:/perl/scripts/data);
> my $serverlist=qw(data/serverlist.ext);
> my %servertype=();
> my %server=();

First, you should be declaring most of these right where you use them,
not all at the top of the script.  Second, while it's certainly perlish
to use one name for more than one variable ($server and %server), it's
conducive to readability.

You should probably have only the following as globals:

#!/c/perl/bin/perl -w
use strict;

my %flavors = (
    hp => { passwd => '/etc/passwd', shadow => '/etc/shadow' },
    default => {
        passwd => '/etc/passwd',
        shadow => '/etc/security/shadow' },
); # similar to wat Thomas Bätzler suggested.
# my $dir = "c:/perl/scripts/data"; # this isn't used anywhere?
my $serverlist = "./data/serverlist.ext";
my (%servers, %servertypes);

open( SERVERLIST, "<$serverlist" )
    or die "Could not open $serverlist: $!";
# no fork()ing was involved, so don't include the word fork
# in the error message.

while (<SERVERLIST>) {
    chomp;
    my ($server, $flavor) = split /,/;
    $flavor = "default" if !exists $flavors{$flavor};
    my %record = (
        SERVER          => $server,
        REMOTE_PASSWD   => $flavors{$flavor}{passwd},
        REMOTE_SHADOW   => $flavors{$flavor}{shadow},
        LOCAL_PASSWD    => "$dir/$server.pass",
        LOCAL_SHADOW    => "$dir/$server.shad",
   );
   $servers{$server} = \%record;
   $servertypes{$server} = \%record if $flavor eq "aix";
}
close SERVERLIST
    or die "Can't close $serverlist: $!";

while( my ($server, $record) = each %servers ) {
    print $record->{LOCAL_PASSWD}, "\n"
        if exists $servertype{$server};
}

__END__


-- 
    "Just how stupid are you Kuno?"
    "Verily, Tatewaki Kuno knows no limits."


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

Date: 14 Oct 2001 04:06:36 GMT
From: Thelma Lubkin <thelma@alpha2.csd.uwm.edu>
Subject: Re: Parsing complex data structure
Message-Id: <9qb30c$uav$1@uwm.edu>

Benjamin Goldberg <goldbb2@earthlink.net> wrote:
: Drew Myers wrote:
:> 
:> Hi.
:> 
:> I have two data structures, one is a simple hash, the other is a bit
:> more complex (actually, there are several more, but I'm only
:> interested in these two for the time being).
:> 
:> My goal, is to print out the information from the complex data
:> structure, if the key exists in the second (simple) hash.
: #!/c/perl/bin/perl -w
: use strict;
                          <snip>
: while (<SERVERLIST>) {
:     chomp;
:     my ($server, $flavor) = split /,/;

        my ($server, $truflavor) = split /,/;
        my $flavor = (exists $flavors{$truflavor}) ? $truflavor:"default";
          
:     #$flavor = "default" if !exists $flavors{$flavor};
:     my %record = (
:         SERVER          => $server,
:         REMOTE_PASSWD   => $flavors{$flavor}{passwd},
:         REMOTE_SHADOW   => $flavors{$flavor}{shadow},
:         LOCAL_PASSWD    => "$dir/$server.pass",
:         LOCAL_SHADOW    => "$dir/$server.shad",
:    );
:    $servers{$server} = \%record;
:    $servertypes{$server} = \%record if $flavor eq "aix";
: }
                          <snip>

       The code above will never see $flavor eq "aix", aix having
       been replaced by "default".  I insert one way of handling
       this above.
                       --thelma




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

Date: Sun, 14 Oct 2001 02:09:18 +0100
From: James Coupe <james@zephyr.org.uk>
Subject: Re: PERL freelance programmer availeable
Message-Id: <rbVKrCh+WOy7Ewgh@gratiano.zephyr.org.uk>

In message <d73a1bf1.0110131559.412112b6@posting.google.com>, Mark 
Draper <cgiprogrammer9932@hotmail.com> writes
>Payment is made upon your %100
>satisfaction.

Could you please satisfy us, then, by not posting jobs adverts in a 
discussion forum?  Usenet tradition suggests that a group with "jobs" in 
the name will suit your purpose somewhat better.

-- 
James Coupe                                                PGP Key: 0x5D623D5D
And if it's all right, I'd kind've like to be your lover         EBD690ECD7A1F
'Cause when you're with me I can't help but be                   B457CA213D7E6
So desperately, uncontrollably happy                            68C3695D623D5D


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

Date: 13 Oct 2001 19:03:11 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: PERL freelance programmer availeable
Message-Id: <m1y9mfnfkw.fsf@halfdome.holdit.com>


[note, I'm making fun of this only because it's off topic. Tongue
is firmly "in cheek", as they say. :-]

>>>>> "Mark" == Mark Draper <cgiprogrammer9932@hotmail.com> writes:

Mark> Hello,
Mark> I'm flexible and quality oriented with a proven track record of
Mark> completing large scale projects ( iqseek.com , slapsearch.com , 
Mark> mydotcom.com ).   I'm open to freelance projects and usually deliver a
Mark> bid for the total project.  Payment is made upon your %100
Mark> satisfaction.  It is my goal to prove my capablities and establish a
Mark> long term business relationship. Please feel free to contact me with
Mark> any questions.

Sure.  I got a few questions.

1) Did you get a copy-editor to review this text?  Apparently not.
After all, you're missing hyphens in "quality-oriented" and "long-term".
And "availeable" has to just look bad to you, I'd hope.

2) What's "%100"?  The hash named 100?

3) What's "PERL"?  We don't discuss that here.

4) Are you aware of existing Usenet conventions that prohibit
commercial activity, including job postings and job solicitations, in
inappropriate groups?

5) "usually" deliver a bid?  Is this determined by your Magic 8-ball?

6) You complete large projects?  But not small ones?

7) Should I hire someone who has only a hotmail account?  What, you
can't spring for the $20/month or so to get a real domain and hosting
service?  How bad *is* your business at the moment.

8) "my dot com dot com".  Surely you're joking?

Mark> Looking Forward, 
Mark>          Mark Draper

o/~ Boldly going forward, cuz we can't find reverse! o/~

%100 = qw(0 Just 1 another 2 Perl 3 hacker,); print "@100{0..3}";

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 14 Oct 2001 03:48:55 GMT
From: "David H. Adler" <dha@panix.com>
Subject: Re: PERL freelance programmer availeable
Message-Id: <slrn9si2p7.4t4.dha@panix2.panix.com>

In article <d73a1bf1.0110131559.412112b6@posting.google.com>, Mark Draper wrote:
> Hello,
> 
> I'm flexible and quality oriented with a proven track record of
> completing large scale projects

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :)  (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

http://jobs.perl.org may be of more use to you

Yours for a better usenet,

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Any sufficiently advanced technology is compatible with magic.
	- The Doctor, Seeing I


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

Date: Sat, 13 Oct 2001 21:21:45 -0400
From: Zimmen Gnauh <yah00204052@yahoo.com>
Subject: regular expression
Message-Id: <3BC8E8A9.16D8A6BB@yahoo.com>

I need to get all the lines that does not contain string "abc",
    awk '/!(abc)/' filename
does not work. What's the correct way? Thanks in advance.



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

Date: Sat, 13 Oct 2001 20:24:57 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: regular expression
Message-Id: <87zo6vqahi.fsf@limey.hpcc.uh.edu>

>> On Sat, 13 Oct 2001 21:21:45 -0400,
>> Zimmen Gnauh <yah00204052@yahoo.com> said:

> I need to get all the lines that does not contain string
> "abc", awk '/!(abc)/' filename does not work. What's the
> correct way?

Why are you asking about awk in comp.lang.perl.misc?

Try comp.unix.programmer, comp.unix.questions or similar
group.

hth
t
-- 
Oh!  I've said too much.  Smithers, use the amnesia ray.


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

Date: Sat, 13 Oct 2001 18:22:54 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: regular expression
Message-Id: <3BC8E8EE.F228DCA6@vpservices.com>

Zimmen Gnauh wrote:
> 
> I need to get all the lines that does not contain string "abc",
>     awk '/!(abc)/' filename
> does not work. What's the correct way? Thanks in advance.

$filename !~ /abc/;

-- 
Jeff



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

Date: Sat, 13 Oct 2001 19:35:40 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: regular expression
Message-Id: <3bc8f9fc$1@news.microsoft.com>

"Zimmen Gnauh" <yah00204052@yahoo.com> wrote in message
news:3BC8E8A9.16D8A6BB@yahoo.com...
> I need to get all the lines that does not contain string "abc",
>     awk '/!(abc)/' filename
> does not work. What's the correct way? Thanks in advance.

There is no Perl function "awk", I suggest to use "grep" instead.
The expressions should be !/abc/
And "filename" is a bare word, probably you meant @filename instead.

jue




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

Date: Sat, 13 Oct 2001 22:52:23 -0400
From: Zimmen Gnauh <yah00204052@yahoo.com>
Subject: Re: regular expression
Message-Id: <3BC8FDE7.1080A7C4@yahoo.com>

      The filename is a real file name, not a variable inside some
script. Obviously,
                $filename !~ /abc/;
won't work in command line. I'm trying to figure out how it is adjusted
for command with awk.

     BTW, I post this question here because I'm not sure if this is a
awk question or regular expression question. My apology for any
inappropriateness.

Jeff Zucker wrote:

> Zimmen Gnauh wrote:
> >
> > I need to get all the lines that does not contain string "abc",
> >     awk '/!(abc)/' filename
> > does not work. What's the correct way? Thanks in advance.
>
> $filename !~ /abc/;
>
> --
> Jeff



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

Date: Sat, 13 Oct 2001 20:15:34 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: regular expression
Message-Id: <3BC90356.FD9C5CF0@vpservices.com>

Zimmen Gnauh wrote:
> 
>       The filename is a real file name, not a variable inside some
> script. 

Then post to psi.telepathy where they can read your mind about what your
situation is.

> won't work in command line. I'm trying to figure out how it is adjusted
> for command with awk.

Then ask in a newsgroup having something to do with awk.

>      BTW, I post this question here because I'm not sure if this is a
> awk question or regular expression question.

If the question was about a perl regular expression than my answer was
sufficient.

> My apology for any
> inappropriateness.

Apology accepted :-)

-- 
Jeff



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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


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