[13341] in Perl-Users-Digest
Perl-Users Digest, Issue: 751 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 9 14:07:15 1999
Date: Thu, 9 Sep 1999 11:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 9 Sep 1999 Volume: 9 Number: 751
Today's topics:
Re: 6 first numbers of a chain of numbers? (Remco Gerlich)
Re: 6 first numbers of a chain of numbers? (Remco Gerlich)
Re: Array of array. <aqumsieh@matrox.com>
Comparing against today's date? <dchurch@kabana.net>
Re: converting a number into a binary? (Larry Rosler)
Re: How do I load libraries from a non-default path ?? <inhouseboxNOifSPAM@yahoo.co.uk>
Re: large dataset problem <aqumsieh@matrox.com>
Re: Looking for a good Perl Book (Kragen Sitaker)
Re: Looking for a good Perl Book <uri@sysarch.com>
MoveLast() with ADODB <michael.furholter@attcanada.net>
MSQL.pm Please Help <cnspots@mindspring.com>
Re: Need help with some pattern matching... <Care227@ibm.net>
Re: Opening URL with Perl <Oliver@pop.k-net.dk>
Parsing tags? (Bror Hellman)
Re: Perl - not Purify clean <gnat@frii.com>
Perl Compilation Roblems on RedHat 6.0 dckinder@mountain.net
Re: Perl fails tests dckinder@my-deja.com
Re: Perl fails tests <flavell@mail.cern.ch>
Perl HTML Grabbing <martinka@EuropeAlive.de>
Perl HTML Grabbing <martinka@EuropeAlive.de>
Re: perl question milowg@my-deja.com
perl replaces smbpasswd? <wschow@Comp.HKBU.Edu.HK>
Re: Please help a newbe jp_48504@my-deja.com
Re: Please help a newbe jp_48504@my-deja.com
Recursively Copy in NT? <perini@acsu.buffalo.edu>
Re: regexp help: Cap First Letter, between tabs <bshow@my-deja.com>
Security on program based level wijonoh@baxter.com
Sorting Array By Field with odd delimiter spsanders@home.com
Sorting Array By Field with odd delimiter spsanders@home.com
Sorting Array By Field with odd delimiter spsanders@home.com
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 Sep 1999 16:58:59 GMT
From: scarblac-spamtrap@pino.selwerd.cx (Remco Gerlich)
Subject: Re: 6 first numbers of a chain of numbers?
Message-Id: <slrn7tfpl6.kq6.scarblac-spamtrap@flits104-37.flits.rug.nl>
Olivier Maas <olivier.maas@at-lci.com> wrote:
> I have a chain of numbers han can be more than 6 numbers
>
> test =~ s/(\d\d\d\d\d\d)\d+/$1/;
^ ^
That should read $test, of course, and '+' means 1 or more. If $test
has only 6 numbers it will fail. Try * there.
Note that something like 1234567sdfasdfasdf will also pass, but
that may be intentional.
> but is there something better?
You can check if the string is all digits, and if the length
is enough.
($test !~ /[^\d]/) && (length($test) >= 6);
That would not accept trailing non-digits. If that behavior
is intentional, do the regex on the first 6 chars only (with
substr).
Then get the first six with substr, if you need them.
Of course, it's doubtful if that's "better", but it's another
way to do it.
Wait - or are you only trying to *get* the first six, without
testing? In that case, just use substr...
--
Remco Gerlich, scarblac@pino.selwerd.cx
------------------------------
Date: 9 Sep 1999 16:56:30 GMT
From: scarblac-spamtrap@pino.selwerd.cx (Remco Gerlich)
Subject: Re: 6 first numbers of a chain of numbers?
Message-Id: <slrn7tfpgi.kq6.scarblac-spamtrap@flits104-37.flits.rug.nl>
Olivier Maas <olivier.maas@at-lci.com> wrote:
> I have a chain of numbers han can be more than 6 numbers
>
> test =~ s/(\d\d\d\d\d\d)\d+/$1/;
^ ^
That should read $test, of course, and '+' means 1 or more. If $test
has only 6 numbers it will fail. Try * there.
Note that something like 1234567sdfasdfasdf will also pass, but
that may be intentional.
> but is there something better?
You can check if the string is all digits, and if the length
is enough.
($test !~ /[^\d]/) && (length($test) >= 6);
That would not accept trailing non-digits. If that behavior
is intentional, do the regex on the first 6 chars only (with
substr).
Of course, it's doubtful if that's "better", but it's another
way to do it.
--
Remco Gerlich, scarblac@pino.selwerd.cx
ACHTUNG! ALLES LOOKENSPEEPERS!
Das Internet ist nicht fuer gefingerclicken und giffengrabben. Ist easy
droppenpacket der routers und overloaden der backbone mit der spammen und
der mime-attachmenten. Ist nicht fuer gewerken bei das dumbkopfen. Das
mausclicken sichtseeren keepen das bandwit-grabben hans in das pockets
muss; relaxen und watchen der cursorblinken.
(Abigail in comp.lang.perl.misc)
------------------------------
Date: Thu, 9 Sep 1999 11:12:14 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Array of array.
Message-Id: <x3yk8q0glv6.fsf@tigre.matrox.com>
dove <doveNOdbSPAM@stanfordalumni.org> writes:
[Just some tips. Ignore if not interested]
> You can print the value of the referenced array by
> dereferencing it as follows:
>
> <PRE>
> for (my $i = 0; $i <= 2; $i++){
This is the C way to iterate through a loop. A more Perlish way would
be:
for my $i (0 .. 2) {
Or to iterate through the indices of all elements in a certain array
@ar:
for my $i (0 .. $#arr) {
> print "Loop Counter: $i\n";
> print "Address: $d[$i]\n";
> print "Value of 0th element : ${$d[$i]}[0]\n";
The expression ${$d[$i]}[0] is more clearly written as:
$d[$i][0]
> }
> </PRE>
>
> So here's a little more complex example:
>
> <PRE>
> my @d=();
That is useless. When you declare an array via my(), it is
empty by default. So, just do:
my @d;
> my @test =("element0", "element1", "element2");
I would write that as:
my @test = qw/element0 element1 element2/;
> my $i =0;
This $i has no relation to the $i's you use in your loops below,
since the latter are localized to the loops via my(). You don't need
the above line.
> #Populate the Array of Arrays
>
> for (my $i = 0; $i <=2; $i++) {
Again,
for my $i (0 .. 2) {
> foreach $element (@test) {
why not my() $element also?
for my $element (@test) {
Note: for() and foreach() are synonyms of one another. They are
exactly identical and you can use them interchangably. You seem to be
treating them differently assuming that they are different
beasts. This is a common newbie mistake.
Writing Perl in a Perlish way is not only natural, but also makes
things much clearer and saves you a lot of key strokes. Every decent
Perl programmer should learn the Perl way of doing things.
HTH,
--Ala
------------------------------
Date: Thu, 9 Sep 1999 11:07:50 -0600
From: "Linux GNUBEE" <dchurch@kabana.net>
Subject: Comparing against today's date?
Message-Id: <7r8pgl$an0$1@macaw.cyberport.com>
I would like to compare a stored date string ('09/09/99' for example) with
the current date.
Do I have to do a split on the stored date to get the individual day, month,
and year values out in order to compare to the values given by
localtime(time)?
If so, do I also need to convert '09' (September) to simply '9' so that the
comparison with the month value generated by localtime(time) will work
correctly?
Thanks!
dan :)
dchurch@kabana.net
------------------------------
Date: Thu, 9 Sep 1999 10:14:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: converting a number into a binary?
Message-Id: <MPG.12418ad5c63332ec989f3b@nntp.hpl.hp.com>
In article <37d70392@cs.colorado.edu+ on 8 Sep 1999 18:47:14 -0700, Tom
Christiansen <tchrist@mox.perl.com+ says...
+ In comp.lang.perl.misc,
+ lr@hpl.hp.com (Larry Rosler) writes:
+ :But I now
+ :see that the general way to convert an arbitrary 32-bit integer to
+ :binary is this:
+ :
+ : $bits = unpack 'B*', pack 'N', $n;
+
+ Well, yes, but I now tell you a more excellent way.
+
+ $n = 181;
+ printf "%b", $n;
+ 10110101
+
+ It's got an inverse, as in
+
+ $n = 0b010110101;
+
+ or read from external data:
+
+ $n = oct('0b010110101')
+
+ ----------------
+ Version 5.005_55
+ ----------------
From my post three levels back:
"I recall that Perl 5.6 will have 'b' conversions in sprintf, but I'm
still trying to figure out how best to solve this problem without them."
So my 'recall' is pretty good! For me, 5.005_55 might as well be 5.6,
because I'm not likely to venture off on a development track.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 09 Sep 1999 09:34:20 -0700
From: InHouseBox <inhouseboxNOifSPAM@yahoo.co.uk>
Subject: Re: How do I load libraries from a non-default path ??
Message-Id: <26f15c5e.f993b95c@usw-ex0102-015.remarq.com>
Which part of the manual,
The bit that talks of setting PERLLIB/PERL5LIB or
use lib '/hard/coded/path';
Boxxy.
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Thu, 9 Sep 1999 11:36:53 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: large dataset problem
Message-Id: <x3yiu5kgkq2.fsf@tigre.matrox.com>
"Stephen Trew" <s.trew@qub.ac.uk> writes:
> One day I hope to help some other novice as you have done for me.
That's the spirit we're looking for.
Who said there aren't any more good people lurking around Usenet
anymore?
--Ala
------------------------------
Date: Thu, 09 Sep 1999 16:14:01 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Looking for a good Perl Book
Message-Id: <d1RB3.13329$r5.912210@typ11.nn.bcandid.com>
In article <x7btca430k.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
>it would need a lot to equal tkman these days. i would love to see that
>in perl. it would be faster and easier for me to debug and hack. i have
>conversed with the author of tkman and he would never rewrite it in
>perl. :-(
Last time I looked at Tkman, it was under a non-free license. Is that
still the case? Will it always be the case?
Kragen
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Thu Sep 09 1999
60 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 09 Sep 1999 13:25:33 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Looking for a good Perl Book
Message-Id: <x7ogfcm1yq.fsf@home.sysarch.com>
>>>>> "KS" == Kragen Sitaker <kragen@dnaco.net> writes:
KS> In article <x7btca430k.fsf@home.sysarch.com>,
KS> Uri Guttman <uri@sysarch.com> wrote:
>> it would need a lot to equal tkman these days. i would love to see that
>> in perl. it would be faster and easier for me to debug and hack. i have
>> conversed with the author of tkman and he would never rewrite it in
>> perl. :-(
KS> Last time I looked at Tkman, it was under a non-free license. Is that
KS> still the case? Will it always be the case?
tkman is free for non-commercial use. it inserts the OTL (U of
california) license in its readme file. it also uses glimpse which has
a real license but i also think it is free to non-commercial users. you
have to register to download it.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Thu, 09 Sep 1999 16:28:42 GMT
From: "Michael Furholter" <michael.furholter@attcanada.net>
Subject: MoveLast() with ADODB
Message-Id: <_eRB3.5184$lk3.27720@cabot.ops.attcanada.net>
I am trying to view the last record of an Access DB by moving to the last
record with MoveLast(). I don't get to the last record and in fact if I
check for EOF or BOF both are true. The recordset is not empty because
MoveFirst(), MoveNext(), MovePrevious() and Move() all work properly.
Am I using MoveLast() properly? Is there another way to view the last record
without changing the order in the SQL?
use OLE;
$cnPeople = CreateObject OLE "ADODB.Connection" || die "CreateObject: $!";
$cnPeople -> Open('myDSN');
$sql = "SELECT * FROM people";
$rsPeople = $cnPeople -> Execute($sql);
$rsPeople->MoveLast();
print "Last Record:\n";
# the following values do not print:
print "Code: " . $rsPeople->Fields('code')->Value;
print "\tName: " . $rsPeople->Fields('name')->Value;
print "\tAge : " . $rsPeople->Fields('age')->Value;
$rsPeople->MoveFirst();
print "\n\nFirst Record:\n";
# the following values do print:
print "Code: " . $rsPeople->Fields('code')->Value;
print "\tName: " . $rsPeople->Fields('name')->Value;
print "\tAge : " . $rsPeople->Fields('age')->Value;
$rsPeople->Close();
$cnPeople->Close();
------------------------------
Date: Thu, 9 Sep 1999 12:26:19 -0400
From: "CNspots" <cnspots@mindspring.com>
Subject: MSQL.pm Please Help
Message-Id: <7r8o5s$eb8$1@nntp3.atl.mindspring.net>
Could someone please tell me what is wrong with thiscode I have been racking
my brains for a week and I still can't figure it out.. Also can anyone
reccomend a good source for learning msql.pm Thanfs
#!/usr/local/bin/perl
use CGI;
use Msql;
use DBI;
$cgiobject=new CGI;
print $cgiobject->header;
#$msql_hostname = "";
#$msql_databasename = "disnco";
$query = new CGI;
#read in submitted Values
if ($query->param)
$ID_str = $query->param('Client_ID');
$Company_str = $query->param('Company');
$Address_str = $query->param('Address');
$City_str = $query->param('City');
$State_str = $query->param('State');
$Country_str = $query->param('Country');
$Zip_str = $query->param('Zip');
$Phone_str = $query->param('Phone');
$Fax_str = $query->param('Fax');
$Email_str = $query->param('Email');
$Web_Site_str = $query->param('Web_Site');
$Refferd_by_str = $query->param('Refferd_by');
$Contact_str = $query->param('Contact');
$Notes_str = $query->param('Notes');
$Alt_Contact_str = $query->param('Alt_Contact');
}
#Connect to Database
$dbh = Msql->Connect("","disnco") or
die "not ok 1: $Msql::db_errstr\n";
#Insert New Client into Database
$self = shift;
$sql = qq[INSERT INTO client (Client_ID,Company,Address) VALUES
($ID_str,$Company_str,
$Address_str)];
$sth= $self->{ dbh }->query($sql);
# CODE BREAKS HERE
print "<HTML><HEAD></HEAD><BODY>";
print $ID_str, "<BR>";
print $Company_str, "<BR>";
print $Address_str, "<BR>";
print $City_str,"<BR>";
print $State_str, "<BR>";
print $Zip_str, "<BR>";
print $Country_str, "<BR>";
print $Phone_str, "<BR>";
print $Fax_str, "<BR>";
print $Email_str, "<BR>";
print $Web_Site_str, "<BR>";
print $Refferd_by_str, "<BR>";
print $Contact_str, "<BR>";
print $Notes_str, "<BR>";
print $Alt_Contact_str, "<BR>";
print "test5";
#Create Output Page
print $cgiobject->footer;
------------------------------
Date: Thu, 09 Sep 1999 13:43:18 -0400
From: Drew Simonis <Care227@ibm.net>
Subject: Re: Need help with some pattern matching...
Message-Id: <37D7F1B6.951043D0@ibm.net>
> Mine probably didn't work because I tested it on a Windows machine and
> didn't use single quotes. I didn't want to backslash because I was
> capturing.
>
> But I like yours better.
Oh, they both work when I properly quoted the regex. I like them both
just fine =)
------------------------------
Date: Thu, 9 Sep 1999 18:51:34 +0200
From: "Oliver Christian Kjær" <Oliver@pop.k-net.dk>
Subject: Re: Opening URL with Perl
Message-Id: <7r8ohv$157u$1@news.net.uni-c.dk>
Problem is I'm behind a firewall.
I've made a little program, but it doesn't seem to work, except on html
files inside my firewall.
Can anyone tell me what could be the problem ???
I've read the "perldoc lwpcook"
#!/usr/local/bin/perl
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->proxy(['http'], 'myproxy.dk:5366'); #With the right proxy and port
number of course
my $req = new HTTP::Request 'http://www.hard-work-studio.dk/main.html';
print $ua->request($req)->as_string;
#---------------------------------------------------------------------------
-
Lars Thegler <lars@thegler.dk> wrote in message
news:37D7AC19.87C2F04@thegler.dk...
"Oliver Christian Kjær" wrote:
>
> Is it possible with a Perl script to open a html file on the internet,
> it could be http://www.something.com/something.html,
> and save it on the disk (on the server). ???
Make sure you've got Bundle::LWP installed, then try 'perldoc lwpbook'.
/Lars
------------------------------
Date: 9 Sep 1999 17:26:58 +0200
From: m8100@abc.se (Bror Hellman)
Subject: Parsing tags?
Message-Id: <7r8jk2$drs@atle.abc.se>
Hello, I would need some help... :-(
I have a large string containing one or more patterns of the type:
<!-- art=XXX -->
or
<!-- ART="XXX" -->
where XXX can be a string of any combination of one or more of
these characters:
[A-Z], [a-z], [0-9], [-+$!:.,;_%=*]
Well.. now.. I need to first match every <!-- ART=XXX --> in this
large string, get the XXX to process, and then substitute all my tags with
something else according to what the argument was. And all matching must
be case insensitive.
Example:
%artists = (
VAN-GOGH => 'ocean',
REMBRANDT => 'sea',
);
$large_string = "My bonnie is over the <!-- ART="Van-GOGH" -->, my bonnie is over the <!-- art=rembrandt -->."
I want to run my program and
print '!',$large_string,'!\n';
and get:
!My bonnie is over the ocean, my bonnie is over the sea.!
Which is the best way to do something like this?
Which is the easiest way?
I would be grateful if someone could help me... I'm not *that* good at
perl...
Yours:
Steamboat Willie aka Bror.
--
.
------------------------------
Date: 09 Sep 1999 11:28:35 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Re: Perl - not Purify clean
Message-Id: <m3ogfc2dvg.fsf@localhost.frii.com>
Frazer Worley <fworley@dal.asp.ti.com> writes:
> Perl is in a pretty sorry state of affairs if it contains these
> type of errors - and in large quantities. And - note I only called
> perl_parse with NULL arguments .... heaven knows how much junk I'd
> be exposed to if I called the function with real arguments.
As was pointed out to this idiot on the perl5-porters mailing list, he
didn't read *all* the perlembed documentation, where it talks about
how to build Perl with Purify support.
He doesn't know whereof he speaks. Ignore him.
Nat
------------------------------
Date: Thu, 09 Sep 1999 16:02:28 GMT
From: dckinder@mountain.net
Subject: Perl Compilation Roblems on RedHat 6.0
Message-Id: <7r8lmb$imt$1@nnrp1.deja.com>
I consistently fail one "make test" when compiling perl5.005_03 on
RedHat 6.0: "lib/anydbm FAILED at test 12"
I have reliably been informed that the RedHat rpm has serious problems,
so using it is not an option.
This happens when I use all the defaults in the perl Configure. I have
also attempted specifically to state that gcc rather than cc is the
compiler, but this makes no difference.
What is worse the CD-1.21 GD:pm will not compile.
When I run a make on it, I get a series of warnings "assignment makes
pointer from Integer without a cast" This happens about 4 times and
then "[GD.o]Error 1"
Then is the end of it.
How can I compile GD:pm under these circumstances. There is no problem
with Perl other than the failed test described above. Are there any
precompiled Perl binaries with GD;pm included? What is wrong with my
compiler (the typical RedHat 6.0 gcc compiler) What is going on?
Thanks in advance.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 09 Sep 1999 16:10:48 GMT
From: dckinder@my-deja.com
Subject: Re: Perl fails tests
Message-Id: <7r8m5p$j63$1@nnrp1.deja.com>
In article <37D7BE2B.DD8C5A6E@mcs.drexel.edu>,
Justin Smith <jsmith@mcs.drexel.edu> wrote:
> When I build Perl 5.003 on my RedHat 6.0 system, it fails one of the
> tests
> (namely the DBM tests). This is significant because latex2html doesn't
> work
> on my system and people tell me that it's because Tied access to
hashes
> doesn't work properly.
>
> Any suggestions>
>
> --
> ______________________________________________________________________
> |
> Time blows wildly against my door | Justin R. Smith
> Stirring discarded sorrows | Department of Mathematics
and
> Like dead leaves of summers past | Computer Science
> Memories of forgotten lore | Drexel University
> Making way for new tomorrows | Philadelphia, PA 19104
> New hopes, new fears, |
> and new ways that last | Office: (215) 895-1847
> |
> c Justin R. Smith, March 14, 1994 | Fax: (215) 895-1582
>
> My home page: http://www.mcs.drexel.edu/~jsmith
>
>
This happens to me too. I am using the most recent version, 5.005_03,
so the previous comments about getting an updated version are not
helpful.
I posted another message about this on this group. I have RedHat 6.0
and its gcc. Just installed it 2 days ago. Also, GD:pm will not
compile.
Please let me know if you find a solution to this.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 9 Sep 1999 19:12:13 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Perl fails tests
Message-Id: <Pine.HPP.3.95a.990909191038.26523B-100000@hpplus03.cern.ch>
On Thu, 9 Sep 1999 dckinder@my-deja.com posted without due care and
attention:
> > Time blows wildly against my door
> > Stirring discarded sorrows
> This happens to me too.
I rest my case.
------------------------------
Date: Thu, 9 Sep 1999 20:01:25 +0200
From: "Martinka" <martinka@EuropeAlive.de>
Subject: Perl HTML Grabbing
Message-Id: <7r8sep$kmg$3@fermi.tro.net>
Hi there!
Is it possible to grab HTML Files from other webpages with standard perl
modules.
I'm trying to programm a system that get's an URL out of a database, prints
the HTML Code found at this adress to the screen (in CGI - to the user
screen as a new HTML-Page) and adds a second perl generated HTML Code to it.
If you know how please tell me!
Thank you for your help
------------------------------
Date: Thu, 9 Sep 1999 20:01:05 +0200
From: "Martinka" <martinka@EuropeAlive.de>
Subject: Perl HTML Grabbing
Message-Id: <7r8sep$kmg$2@fermi.tro.net>
Hi there!
Is it possible to grab HTML Files from other webpages with standard perl
modules.
I'm trying to programm a system that get's an URL out of a database, prints
the HTML Code found at this adress to the screen (in CGI - to the user
screen as a new HTML-Page) and adds a second perl generated HTML Code to it.
If you know how please tell me!
Thank you for your help
------------------------------
Date: Thu, 09 Sep 1999 16:03:52 GMT
From: milowg@my-deja.com
Subject: Re: perl question
Message-Id: <7r8lot$inu$1@nnrp1.deja.com>
In article <7r7a8g$jol$1@nnrp1.deja.com>,
salo2000@my-deja.com wrote:
> I've just started studying perl from a book
> I have a problem relating to different parts of a regular expression
as
> different expressions using the delimiter "_". for example
> the expression in TTT file is : "x_y_z_t". I would like to compare
each
> part of this expression, to other expression's part from RRR file lets
> say "g_h_z_t" so I would like to check if the first x (in TTT file) is
> similar to the first g (in RRR file) and then if the second y is
> similar to the second h
> could anyone help me with that ?
> thanks in advance
Assuming your strings have the same amount of delimiters in them (ie.
same number of letters in the above example), you can split them both up
and compare them one by one:
$ttt = "x_y_z_t";
$rrr = "g_h_z_t";
@ttt_array = split(/_/, $ttt);
@rrr_array = split(/_/, $rrr);
#compare
for ($i = 0; $i < $#ttt_array; ++$i)
{
if ($ttt_array[$i] == $rrr_array[$i])
{
#We found it!
}
}
Hope this helps!
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 9 Sep 1999 16:24:20 GMT
From: "Mr. Chow Wing Siu" <wschow@Comp.HKBU.Edu.HK>
Subject: perl replaces smbpasswd?
Message-Id: <7r8mvk$tds$1@power25t.hkbu.edu.hk>
Hi,
I would like to know if there's any perl program may
replace the smbpasswd to change SMB password and add/del
users?
Thanks.
- --
PGP PUBLIC KEY: https://www.comp.hkbu.edu.hk/~wschow/pgp.html
Key fingerprint = 15 C4 36 D6 EC CF 1D A4 7F D8 F9 EF 2E D7 32 A6
Tel: 2339 5050 (Direct) Fax: 2339 7892
Version: 2.6.3i
Charset: noconv
iQCVAwUBN9ffbL3ixeOqBhAdAQFE3wP+NocYtn+rk7cj+MRr5398DhMpzrNzTCbv
IOze1zqbG4gwXvZRYaBSYZ6Dsc3vPRe6KdhqenM2PDW+qmMWR7WHQwZpI92GNKVf
3Q9fKP9YN5BO7JqLaFgoYZQfWW0GN4IGI7FRPSvYV26dLfrGKl6qLyi2Jy/Je55m
E81hFLv8fCY=
=W9ON
-----END PGP SIGNATURE-----
------------------------------
Date: Thu, 09 Sep 1999 15:58:40 GMT
From: jp_48504@my-deja.com
Subject: Re: Please help a newbe
Message-Id: <7r8lf7$iir$1@nnrp1.deja.com>
In article <37D7B9E1.CAEA7062@mediaone.net>,
edgar <cook@mediaone.net> wrote:
> #! perl -w
> use strict;
> ### taken from perl cook book pp281 with chg's
>
> print " To store an array of lines in reverse order \n";
> my @lines = reverse (<DATA>);
> print @lines;
> print "\n Now reversing the order!! or back to what it looks like ???
\n";
> my @rev_lines = reverse @lines;
>
> for ( @rev_lines){
> print $_;
> }
>
> __DATA__
> 1 this is first 145
> 2 in second 135
> 3 asdffdsa last 124
>
> tried on a win9x PC
> hope this helps
> -cookie
>
>
Thanks Cookie,
Will I be able to have my script read the specific numbers from the
file and then provide a total to the user?
Thanks
JP
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 09 Sep 1999 15:59:22 GMT
From: jp_48504@my-deja.com
Subject: Re: Please help a newbe
Message-Id: <7r8lgh$ij8$1@nnrp1.deja.com>
In article <37D7B9E1.CAEA7062@mediaone.net>,
edgar <cook@mediaone.net> wrote:
> #! perl -w
> use strict;
> ### taken from perl cook book pp281 with chg's
>
> print " To store an array of lines in reverse order \n";
> my @lines = reverse (<DATA>);
> print @lines;
> print "\n Now reversing the order!! or back to what it looks like ???
\n";
> my @rev_lines = reverse @lines;
>
> for ( @rev_lines){
> print $_;
> }
>
> __DATA__
> 1 this is first 145
> 2 in second 135
> 3 asdffdsa last 124
>
> tried on a win9x PC
> hope this helps
> -cookie
>
>
Thanks Cookie,
Will I be able to have my script read the specific numbers from the
file and then provide a total to the user using this?
Thanks
JP
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 10 Sep 1999 00:02:17 -0400
From: Robert J Perini <perini@acsu.buffalo.edu>
Subject: Recursively Copy in NT?
Message-Id: <7r8m17$r05$1@prometheus.acsu.buffalo.edu>
I'm looking for an easy way to copy a series of directories like this:
basedir
--dir1
--dir2
I want to copy all of the basedir files and the ones below the directory. If
this was unix I'd be using
cp with the -R switch. Please send email to me.
Thanks in advance
--
Bob Perini
Walkway Technology Node, SUNY Buffalo College
Instructional Programmer
------------------------------
Date: Thu, 09 Sep 1999 16:58:55 GMT
From: Bob Showalter <bshow@my-deja.com>
Subject: Re: regexp help: Cap First Letter, between tabs
Message-Id: <7r8p06$li5$1@nnrp1.deja.com>
In article <7r8i80$ufu$1@news.doit.wisc.edu>,
"Ross Yahnke" <rcyahnke@doit.wisc.edu> wrote:
> Hi all - I've tried various ways to do this but am stumped. Given a
text
> string:
> RCY <tab> ROSS C. HOLLINGSWORTH-YAHNKE, ESQ. <tab>
rcyahnke@doit.wisc.edu
>
> (replace <tab> with \t )
>
> I'd like to get:
>
> RCY <tab> Ross C. Hollingsworth-Yahnke, Esq. <tab>
rcyahnke@doit.wisc.edu
>
> I've tried things like
> s/\t(\w+)/\t\u\L\1/;
Your subject says you want to capitalize first letter between tabs, and
your regex will capitalize the first letter following a tab (and lower
at least one following char). But that's not what you say you'd "like
to get".
The (\w+) in your regex matches the text "ROSS", so your regex changes
only OSS to lower case.
Here's a regex that gives the output you say you want:
s/(\W)(\w+)/$1\u\L$2/g;
You want to capitalize the C in C., the H in Hollingsworth, etc., but
these do not follow a tab. I'm just capitalizing "words" following
a "non-word" char. Note this does not match at the beginning of the
string, so "RCY" is not matched.
HTH,
-- Bob
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 09 Sep 1999 16:02:40 GMT
From: wijonoh@baxter.com
Subject: Security on program based level
Message-Id: <7r8lmm$imu$1@nnrp1.deja.com>
Hi,
I am creating a security model to restrict the information only to a
certain users. I tried to use a server-sided cookie, but there is not
much information/resources out there to really look on. The way it
should work is when a user access the page, he/she can have access to
the page that is assigned, based on the user id. however, he/she can't
access other pages that they were not assigned. There will be a time out
when there is no activity after a certain period of time. so user has to
login again. I really appreciate for all your help. Thank you.
Sincerely,
henry wijono
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 09 Sep 1999 17:52:44 GMT
From: spsanders@home.com
Subject: Sorting Array By Field with odd delimiter
Message-Id: <7r8s55$o4m$1@nnrp1.deja.com>
I am trying to sort three arrays. These arrays get piped to a cgi that
creates a webpage. I want the table to be sorted by the IP address
field, (to organize by subnets)
The Contents of the arrays are
<tr><td>$computer</td><td>$ipaddress</td><td>$currengine</td><td>$os
</td><td>$sp</td><td>
So I need to split on </td><td> and sort on the [1] element (I think)
and then process it accordingly.
Any pointers would be greatly appreciated.
Thanks,
Shawn
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 09 Sep 1999 17:52:44 GMT
From: spsanders@home.com
Subject: Sorting Array By Field with odd delimiter
Message-Id: <7r8s56$o4o$1@nnrp1.deja.com>
I am trying to sort three arrays. These arrays get piped to a cgi that
creates a webpage. I want the table to be sorted by the IP address
field, (to organize by subnets)
The Contents of the arrays are
<tr><td>$computer</td><td>$ipaddress</td><td>$currengine</td><td>$os
</td><td>$sp</td><td>
So I need to split on </td><td> and sort on the [1] element (I think)
and then process it accordingly.
Any pointers would be greatly appreciated.
Thanks,
Shawn
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 09 Sep 1999 17:52:45 GMT
From: spsanders@home.com
Subject: Sorting Array By Field with odd delimiter
Message-Id: <7r8s56$o4p$1@nnrp1.deja.com>
I am trying to sort three arrays. These arrays get piped to a cgi that
creates a webpage. I want the table to be sorted by the IP address
field, (to organize by subnets)
The Contents of the arrays are
<tr><td>$computer</td><td>$ipaddress</td><td>$currengine</td><td>$os
</td><td>$sp</td><td>
So I need to split on </td><td> and sort on the [1] element (I think)
and then process it accordingly.
Any pointers would be greatly appreciated.
Thanks,
Shawn
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 751
*************************************