[8151] in Perl-Users-Digest
Perl-Users Digest, Issue: 1769 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 30 11:17:29 1998
Date: Fri, 30 Jan 98 08: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 Fri, 30 Jan 1998 Volume: 8 Number: 1769
Today's topics:
Re: 5 REAL languages (was: Re: AOL SPAM) <spt@cstr.ed.ac.uk>
Re: 5 REAL languages (was: Re: AOL SPAM) <spt@cstr.ed.ac.uk>
Re: Array refs and hashes -- bug or misunderstanding? <jdporter@min.net>
boston.pm.org (Chris Nandor)
C++ <dan.albertsson@swipnet.se>
can variables be generated on the fly (Vjekoslav Balas)
Re: can variables be generated on the fly (Andrew M. Langmead)
Re: can variables be generated on the fly (Mike Stok)
Connecting to Oracle with Perl and ADO <baileyr@cinternet.net>
Re: How does REMOTE_USER work <peredina@bedford.progress.com>
Re: How does REMOTE_USER work (Tad McClellan)
Re: HTML/CGI to play midi file? <webmaster@fccj.cc.fl.us>
I would like for a field to be variable width in a form <brannon@surf.usc.edu>
Re: living and free software (was: Re: source into bina <spt@cstr.ed.ac.uk>
Pattern matching poser (Terry von Gease)
Re: Pattern matching poser (Steve Linberg)
Perl 5.001 (NT Resource Kit) on NT4 SP3 / IIS3.0 <mik@mcgb.co.uk>
Re: Printing in triplicate... (Clay Irving)
Re: Problems converting Bourne shell to Perl <jdporter@min.net>
require "./setup.pl" # never works for me <david@thames.com>
Re: require "./setup.pl" # never works for me (Mike Stok)
Re: Some possible bugs (I R A Aggie)
Re: Strings to integers HELP please (Tad McClellan)
Re: Want to determine the subnet networks from a networ kevinm@crt.com
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Jan 1998 15:39:55 +0000
From: Richard Caley <spt@cstr.ed.ac.uk>
Subject: Re: 5 REAL languages (was: Re: AOL SPAM)
Message-Id: <eyhzpke0y44.fsf@liddell.cstr.ed.ac.uk>
In article <34D0B450.1A60@min.net>, John Porter (jp) writes:
jp> Actually I was thinking
jp> Intercal
jp> Pilot
jp> Postscript
jp> Trac
jp> Python
Those are unreal.
What about parlog. Gotta have a place for the `go away and try
everything at the same time and come back if you find anything
interesting' school of programming.
--
Mail me as rjc not spt@cstr.ed.ac.uk _O_
|<
------------------------------
Date: 30 Jan 1998 15:40:57 +0000
From: Richard Caley <spt@cstr.ed.ac.uk>
Subject: Re: 5 REAL languages (was: Re: AOL SPAM)
Message-Id: <eyhyazy0y2e.fsf@liddell.cstr.ed.ac.uk>
Oh come on, we have 5 languages in our system already, and that's not
counting the shell scripts...
--
Mail me as rjc not spt@cstr.ed.ac.uk _O_
|<
------------------------------
Date: Fri, 30 Jan 1998 10:36:35 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Array refs and hashes -- bug or misunderstanding?
Message-Id: <34D1F383.14BA@min.net>
Larry Rosler wrote:
>
> The program constructs a reference to an array and puts the
> reference into both the key and the value of a one-item hash.
That should have been a clue.
> #!/usr/local/bin/perl -w
> $ref = [ 1, 2, 3 ];
> $list{$ref} = $ref;
> print "$ref |@$ref|\n";
> print "$list{$ref} |@{$list{$ref}}|\n";
> print map { "$_ |@{$list{$_}}|\n" } values %list;
> print map { "$_ |@{$list{$_}}|\n" } keys %list;
> print map { "$_ |@$_|\n" } values %list;
> print map { "$_ |@$_|\n" } keys %list;
As long as the thing you're trying to de-ref comes from
the VALUES of the hash, you're getting a real ref, which
you can de-ref at will.
If you try to de-ref the thing you get from the KEYS of the
hash, you lose; as you know, using a ref as a hash key
actually uses a stringized form of the ref (since keys must
be strings). In all past and current implementations,
information is lost in the stringizing process, so the
transformation is "one-way".
The two lines to compare are:
> print map { "$_ |@{$list{$_}}|\n" } keys %list;
> print map { "$_ |@$_|\n" } keys %list;
In the first case, you get the key, and then turn right
around and use it as a hash key again, to get the ref
from the VALUE of that entry.
In the second case, you try to de-ref the thing directly.
Obviously that doesn't work.
hth,
John Porter
------------------------------
Date: Fri, 30 Jan 1998 09:08:27 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: boston.pm.org
Message-Id: <pudge-3001980908270001@ppp-9.ts-1.kin.idt.net>
All Boston-area people ... I don't have many tuits lying around, but I
think it would be cool to get a Boston Perl Mongers group going. If
anyone is interested, drop me a line. See http://ny.pm.org/ for an
example of how NY is doing it. They will give us the boston.pm.org name
if we want it, too.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
#== New Book: MacPerl: Programming for the Rest of Us ==#
#== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==#
------------------------------
Date: 30 Jan 1998 13:56:31 GMT
From: "DAN ALBERTSSON" <dan.albertsson@swipnet.se>
Subject: C++
Message-Id: <01baef1a$6d647c00$6e67f482@default>
I don't know if there will be an object oriented perl in the near future
but for a perl rookie it seems powerful enough.
But is there an IDE for Unix (and/or Windows) out there with color syntax
highlightning or someting like that.
Which is the best book on CGI-Perl.
Is it possible to create you own library with functions and call them from
other perl programs. (How do I declare and call them).
There is maybe more than one way to do it.
/Thanks
Dan
------------------------------
Date: 30 Jan 1998 13:56:17 GMT
From: eedvab@eed.ericsson.se (Vjekoslav Balas)
Subject: can variables be generated on the fly
Message-Id: <6asm61$akq5@aken.eed.ericsson.se>
Hi,
This may be a silly question, just thought maybe with perl it was possible
as it is so good with parsing etc:
Can a varibale be generated - this syntax is not correct but shows idea I'm on about:
$a="var1";
$"$a"="value of generated variable";
(supposed to read something like
$var1="value of generated variable";
Thanks,
Vjeko
------------------------------
Date: Fri, 30 Jan 1998 15:22:30 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: can variables be generated on the fly
Message-Id: <EnLs1J.Is3@world.std.com>
eedvab@eed.ericsson.se (Vjekoslav Balas) writes:
>Subject: Re: can variables be generated on the fly
>This may be a silly question, just thought maybe with perl it was possible
>as it is so good with parsing etc:
Its a feature called symbolic references. The feature exists, but
there use is strongly discouraged, and in most cases can be easily
replaced by a hash. See the perlref man page for details.
$a="var1";
$$a"="value of generated variable";
print $var1;
--
Andrew Langmead
------------------------------
Date: 30 Jan 1998 10:23:17 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: can variables be generated on the fly
Message-Id: <6asr95$14v$1@stok.co.uk>
In article <6asm61$akq5@aken.eed.ericsson.se>,
Vjekoslav Balas <eedvab@eed.ericsson.se> wrote:
>Hi,
>This may be a silly question, just thought maybe with perl it was possible
>as it is so good with parsing etc:
>
>Can a varibale be generated - this syntax is not correct but shows idea I'm on about:
>$a="var1";
>$"$a"="value of generated variable";
You can use perl 5's soft references e.g.
{
no strict 'refs'; # in case you're using strict
$a = 'var1';
$$a = 'value of generated variable';
}
the no strict refs will alert a maintainer that you're planning to use
a simple scalar as a reference in the block (hence the enclosing {}) and
the $$a uses $a as a variable name.
You can do a similar thing with perl 4 and perl 5 using type globbing
(search http://www.dejanews.com, maybe in the old database for examples),
and for many cases where this kind of thing seems to be required it might
be worth thinking whether it can be done with a hash indexed by variable
name.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Fri, 30 Jan 1998 07:43:28 -0500
From: "Rick Bailey" <baileyr@cinternet.net>
Subject: Connecting to Oracle with Perl and ADO
Message-Id: <6asi1q$cr7$1@hirame.wwa.com>
Platform: Windows NT 4.0
Oracle 7.3.3
ADO 1.5
We have a script that connects to an Oracle database via ADO using a system
dsn on our NT box. If we run the script from the dos prompt, the script
connects fine, and runs like it should. However, whenever we run the script
from a browser, it refuses to connect to the database.
Has anyone ever seen anything like this on NT?
Thanks,
Rick Bailey
Richard.Bailey@infores.com
------------------------------
Date: Fri, 30 Jan 1998 07:51:59 -0500
From: Curt Peredina <peredina@bedford.progress.com>
To: lsmeets@best.ms.philips.com
Subject: Re: How does REMOTE_USER work
Message-Id: <34D1CCEF.72B458D4@bedford.progress.com>
Luc Smeets wrote:
> After authentication I want to use the given username.
> REMOTE_USER is an evironment variable which should return the username.
>
> Problem:
> REMOTE_USER returns nothing.
>
> Questions:
> Are the environment variables initialized by the browser (so, the
> browser is causing the problem) or by the HTTP-server (I use Apache)?
> How do I use the environment variables in my Perl scripts? Do I need a
> module for it?
>
used as: $ENV{'REMOTE_USER'} REMOTE_USER is only available if server
authentication is activated - a subject for another group.
------------------------------
Date: Fri, 30 Jan 1998 07:06:22 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How does REMOTE_USER work
Message-Id: <e8jsa6.no.ln@localhost>
Luc Smeets (lsmeets@best.ms.philips.com) wrote:
: Questions:
: Are the environment variables initialized by the browser
Ummm. This is the Perl newsgroup. Perl doesn't have a browser thingy.
You should probably ask browser questions in a newsgroup that
is in someway related to browsers:
comp.infosystems.www.browsers.mac
comp.infosystems.www.browsers.misc
comp.infosystems.www.browsers.ms-windows
comp.infosystems.www.browsers.x
: (so, the
: browser is causing the problem) or by the HTTP-server (I use Apache)?
Ummm. This is the Perl newsgroup. Perl doesn't have a server thingy.
You should probably ask server questions in a newsgroup that
is in someway related to servers:
comp.infosystems.www.servers.mac
comp.infosystems.www.servers.misc
comp.infosystems.www.servers.ms-windows
comp.infosystems.www.servers.unix
Or maybe:
comp.infosystems.www.authoring.cgi
: How do I use the environment variables in my Perl scripts?
print "you came to my site from $ENV{REMOTE_USER}\n";
: Do I need a
: module for it?
No.
: Thanks if you can help me,
Please post only Perl questions to the Perl newsgroup.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 30 Jan 1998 07:47:27 -0500
From: "Bill Jones, FCCJ Webmaster" <webmaster@fccj.cc.fl.us>
Subject: Re: HTML/CGI to play midi file?
Message-Id: <34D1CBDF.842046F1@fccj.cc.fl.us>
Clam down and simply stop answering these questions :-)
Relax - if they truly want to know they will find out for themselves!
Most of us do appreciate you, Brian :-)
Luv,
Perl
NOTE: The previous was forwarded by Bill, not that he may or may not
believe what it says!
brian d foy wrote:
>
> In article <6argcd$q89$1@hermes.seas.smu.edu>, "Scott Norris" <snorris@post.cis.smu.edu> posted:
>
> >Also, what/where is the CGI Meta FAQ?
>
> look at the bottom of any (well, most) of my posts. you'll see
> two references. the CGI Meta FAQ is one of them. i'm considering
> trashing the damn thing though because the time i save in not
> typing the references in the CGI Meta FAQ are taken up answering this
> stupid question.
>
> just about every thing that's reference-able i reference. if
> i mention a resource, you'll see it's address. i'm one of the
> few persons that uses footnotes in my postings. and i still have
> to deal with crap like this. i never wanted to be Sisyphus.
>
> fuck it. i'm outta here for awhile. ever wonder why i left
> comp.infosystems.www.authoring.cgi? same fucking reason i'm leaving
> this group for awhile.
>
> help save usenet:
>
> THE FUCKING ADDRESS IS ON THE NEXT LINE!
> <URL:http://www.boutell.com/boutell/usenet.html>
> THE FUCKING ADDRESS IS ON THE PREVIOUS LINE!
>
> --
> brian d foy <comdog@computerdog.com>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
> Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
> even after taking a walk to the deli, i've decided to say "fuck"
------------------------------
Date: 30 Jan 1998 05:45:18 -0800
From: Terrence Brannon <brannon@surf.usc.edu>
Subject: I would like for a field to be variable width in a format stmt
Message-Id: <lboh0u6pox.fsf@surf.usc.edu>
The following does not print out $mechname or $plotvar, just one
character of each. I would like a way to insert the text of these
variables without manually entering <<<< each time I change $mechname
or $plotvar
#!/usr/bin/perl
$mechname="migna";
$plotvar="ninf";
strdef sc
create soma
access soma
insert $mechname
system("rm @_@")
$mechname, $plotvar
for (g = -100; g <= 75; g=g+5) {
rates_@(g)
$mechname
sprint (sc, "echo %f %f >> @_@\n", g, @_@)
$mechname, plotvar, $plotvar, $mechname
printf ("%s\n", sc)
system (sc)
}
.
--
Terrence Brannon * brannon@lnc.usc.edu * http://lnc.usc.edu/~brannon
USC, HNB, 3614 Watt Way, Los Angeles, CA 90089-2520 * (213) 740-3397
Great Milk Debate... http://www.milk.com vs. http://www.notmilk.com
------------------------------
Date: 30 Jan 1998 15:36:52 +0000
From: Richard Caley <spt@cstr.ed.ac.uk>
Subject: Re: living and free software (was: Re: source into binary code)
Message-Id: <eyh1zxq2ctn.fsf@liddell.cstr.ed.ac.uk>
In article <6aildl$1j9$1@news.orst.edu>, John Stanley (js) writes:
>> Are people who sell some other kind of broken product causing harm?
js> Nice try. "casuing harm" is not the same as "causing harm to
js> society."
Make the substitution then. I wasn't making a claim I was asking a
question to determine what was to count as harm.
>> Some people still think that those who sell software sans source or
>> video tapes which turn to snow simulators after a few uses are not
>> nice.
js> Another nice try. "Not nice" is a long way from "causes harm to
js> society."
Since "causes harm to society." is pretty meaningless I was trying to
avoid it until I have some idea what is supposed to be meant by it.
--
Mail me as rjc not spt@cstr.ed.ac.uk _O_
|<
------------------------------
Date: 29 Jan 1998 16:53:52 GMT
From: twv@cup.hp.com (Terry von Gease)
Subject: Pattern matching poser
Message-Id: <6aqc70$608$1@ocean.cup.hp.com>
I know intuitively that this is impossible but I can't prove it. So
maybe it's not so impossible...
Given two regular expressions, is there any way to determine that
there exists any string that will match both patterns? In other words,
is there an intersection?
That would be determine analytically, not empirically. Any doofus could
itterate through all combinations of some finite length string.
For example, given...
$pattern1='[123]?\d+bob.*'
$pattern2='\s*\d+.*'
Then could there exist some function that would determine if there was
or was not some string that would match both $pattern1 and $pattern2?
--
Terry A proper signature should sum up one's entire
philosophy and, at the same time, cause anyone who
reads it to question everything in which they
believe.
------------------------------
Date: Fri, 30 Jan 1998 09:11:23 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Pattern matching poser
Message-Id: <linberg-3001980911240001@projdirc.literacy.upenn.edu>
In article <6aqc70$608$1@ocean.cup.hp.com>, twv@cup.hp.com (Terry von
Gease) wrote:
> I know intuitively that this is impossible but I can't prove it. So
> maybe it's not so impossible...
>
> Given two regular expressions, is there any way to determine that
> there exists any string that will match both patterns? In other words,
> is there an intersection?
>
> That would be determine analytically, not empirically. Any doofus could
> itterate through all combinations of some finite length string.
>
> For example, given...
>
> $pattern1='[123]?\d+bob.*'
> $pattern2='\s*\d+.*'
>
> Then could there exist some function that would determine if there was
> or was not some string that would match both $pattern1 and $pattern2?
Yuk. Sounds hard if you want to be purely analytical. Is there a reason
you don't want to be empirical (e.g. if ($foo =~ $pattern1 && $foo =~
$pattern2) {...})? Determining the intersection of X regexps would be an
order of magnitude harder, and the empirical approach would probably be
quicker (it seems to me) than any analytical method you could come up
with. You could gain a lot of flexibility by constructing and eval'ing
the string youself on the fly.
Just curious. An interesting problem.
------------------------------
Date: 28 Jan 98 20:40:43 GMT
From: "Mik Porter" <mik@mcgb.co.uk>
Subject: Perl 5.001 (NT Resource Kit) on NT4 SP3 / IIS3.0
Message-Id: <01bd2c2d$1a6c0840$0140a8c0@cacofonix>
I'm trying to install the version of Perl for NT on the NT Resource kit so
I can model my hosted web site on my servers at home. I'm running IIS3
with ASP on NT4 SP3. I've made the necessary shell mods to associate the
executables and everything runs at the command line and by double-clicking
a script in NT explorer. I've created an executable virtual directory
called "cgi-bin" to mirror the setup on my web site to hold my scripts.
If I POST from a form I get an HTTP Unsupported return, and if I use GET I
get an access error stating that the directory cannot be read from.
I've also tried in the default scripts directory under IIS with the same
results.
What am I doing wrong??
Posts or mails to mik@mcgb.co.uk greatly appreciated.
Mik Porter
------------------------------
Date: 30 Jan 1998 09:25:44 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Printing in triplicate...
Message-Id: <6asnt8$s1b@panix.com>
In <6aqaso$2ss$1@cletus.bright.net> "Franklin L. Petersen" <orangutan@grungyape.com> writes:
>Can someone tell me why this is printing my results to the screen in
>triplicate?
>(ie: 1234.gif 1234.gif 1234.gif)
>I did check the file.txt there is only one occurrance....
>so it's not because the same info is reprinted in there multiple times.
>Thanks,
>Frank
>orangutan@grungyape.com
>$textfile = "file.txt";
>$flag = 0;
>$date = `/usr/bin/date`;
my $count = 0;
>## Start the Program
>print "Content-type: text/html\n\n" ;
>read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>@pairs = split(/&/, $buffer);
>foreach $pair (@pairs){
> ($name, $value) = split(/=/, $pair);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $name =~ tr/+/ /;
> $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $FORM{$name} = $value
> }
>$partnum = $FORM{'newpart'};
>open ( TF, $textfile ) || die "Couldn't open $textfile for reading";
> while ( <TF> ) {
> $groupList = $_;
> @fileList = split (/\s+/, $groupList);
> foreach $fileSet (@fileList) {
$count++;
> ($number, $letter, $path) = split ( /\s+/, $groupList );
> chomp ( $number );
> if ( $number eq $partnum ){
> $flag = 1;
> ($drive, $dwgs, $num1, $num2, $graphic) = split
>(/\\/, $path);
> print "<base target=\"body\">\n";
> print "<a
>href=\"/drawing/eng/$dwgs/$num1/$num2/$graphic\">$graphic</a>\n";
> }
> }
> }
print "Looped $count times.\n";
> if ( $flag eq "0" ) {
> print "<body bgcolor=white>\n";
> print "<center><h2>I'm sorry, there was no matching part number
>found</h2></center>\n";
> }
>close ( TF );
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Fri, 30 Jan 1998 10:18:42 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Problems converting Bourne shell to Perl
Message-Id: <34D1EF52.756A@min.net>
Steve Bourgeois wrote:
>
> COMMAND <<_EOF_
> line 1
> line 2
> ...
> _EOF_
>
> How can I do this in Perl? The Perl "here document" functionality
> seems similar, but it doesn't appear to work the same way.
The thing you must always remember is that the "special string"
(in your example, _EOF_) is simply substituted with the text
of the here document; you still have an obligation to terminate
Perl statements with a semicolon -- something not present in sh.
Examples:
print <<_EOF_;
yadda
yada
_EOF_
@a = split( "\n", <<names );
tom
dick
harry
names
Here documents have all kinds of nifty features you never dreamed
of if you're used to the Bourne shell.
1. if you quote the "special string", that quoting style applies
to the text of the here document. Double quotes is the default,
but you can also single quotes or even backticks.
2. multiple here documents can occur in one statement; they are
expected consecutively after the statement, e.g.:
@cmd{ qw( usage printfmt ) } = ( <<"_usage_", <<'_printfmt_' );
usage: $cmd{'command'} $cmd{'args'}
_usage_
%s %-9d %04x
_printfmt_
hth,
John Porter
------------------------------
Date: Sat, 31 Jan 1998 12:28:24 -0000
From: "David Rayner" <david@thames.com>
Subject: require "./setup.pl" # never works for me
Message-Id: <886173955.9946.0.nnrp-02.9e9837ac@news.demon.co.uk>
require "./setup.pl" # never works for me
I always have to put the full path in such
require "/home/www/cgi/setup.pl" # is fine
I 've come across this on a variety of servers and Perl versions
Que????
Please Post & mail replies thanks
------------------------------
Date: 30 Jan 1998 10:37:19 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: require "./setup.pl" # never works for me
Message-Id: <6ass3f$174$1@stok.co.uk>
In article <886173955.9946.0.nnrp-02.9e9837ac@news.demon.co.uk>,
David Rayner <david@thames.com> wrote:
>require "./setup.pl" # never works for me
>
>I always have to put the full path in such
>
>require "/home/www/cgi/setup.pl" # is fine
>
>I 've come across this on a variety of servers and Perl versions
That's probably because the working directory thet the web server has when
is spawns a CGI script (making the assumption that it doesn;t work when
you're running under a web server...)
One thing you can do is to use a line like
use lib '/home/www/cgi';
in your script which puts the directory in @INC at compile time so that
it'll be searched automatically when you say
require 'setup.pl';
There are various helpful hints to be found on CPAN (the comprehensive
perl archive network) which can be reached at http://www.perl.com/ and
following links. One simple checklist is at:
http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Fri, 30 Jan 1998 10:04:06 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Some possible bugs
Message-Id: <fl_aggie-3001981004060001@aggie.coaps.fsu.edu>
In article <886161381.1421803532@dejanews.com>, shaker@netusa1.net wrote:
+ I will gladly upgrade. However, it is going to take some time. We have
+ perl and several other 'tools' in a central (so-called) software bank. I
+ have to persuade the maintainers of this to perform the upgrade for me.
Tell 'em perl v4 is dead. Tell 'em perl v4 is insecure.
James
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Fri, 30 Jan 1998 06:57:30 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Strings to integers HELP please
Message-Id: <qnisa6.hn.ln@localhost>
Richard Wilde (rippo@kc3ltd.co.uk) wrote:
: Please help,
Please help yourself.
If you had followed correct netiquette, then besides avoiding having
everyone think you are a rather rude sort of person, you could also
have had the answer to your question in a few *seconds*!!
^^^^^^ ^^^^^^^^^^^^^^
Perl FAQ, part 4:
"How do I determine whether a scalar is a number/whole/integer/float?"
Use the docs, Luke.
: The perl script must ignore the form{'quanity'} variable if there are
: any non-numerical characters in it.
If this number is meant to be a quantity, then you might want to
call it 'quantity' instead of 'quanity'...
: For example if the user inputs:
: '3*8' - Perl will treat this as 3
: '10p' - Perl will treat this as 10
: '1 3' - Perl will treat this as 1
: 'p10' - Perl ignores this
Actually, perl treats that last one as zero, which is somewhat different
than 'ignoring' it...
: I would be grateful if somebody could give me a solution.
We would be grateful if you could find the time to see if your question
has already been asked and answered a few hundreds times before
posting it yet again...
: I look forward to hearing from you.
Uh huh.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 30 Jan 1998 08:11:10 -0600
From: kevinm@crt.com
Subject: Re: Want to determine the subnet networks from a network:subnet combo.
Message-Id: <886168998.1689780232@dejanews.com>
In article <6apl65$n4p$1@anais.eerie.fr>,
trs@eerie.fr (Francois Trousset) wrote:
>
> In article <886002623.1144782858@dejanews.com>,
> kevinm@crt.com writes:
> > Need help. Wanting to get a list of the networks that would be derived
> > from 10.216 subnetmasked 255.255.240.0. The subnets that I should get
> > back will be 10.216.0 and 10.216.16 - 10.216.240 (in increments of 16)
> > but I don't know how exactly to code this. I've got h2n and it says
> > something about bitwise or'ing to do this but I'm really very new at perl
> > and am not sure what this is all about. Any help will be greatly
> > appreciated. Thanks.
>
> Hi,
>
> To do something general, you may obtain the increment by
> substracting the netmask to 256.256.256.256 and do a modulo
> 256 on each of the 4 bytes otained. Then you get 1.1.16.0.
> Then from the network number, you just have to do a loop for
> each non-null leading byte, that means
>
> for ( $byte1 = 10 ; $byte1 < 256 ; $byte1 += 1 )
> { for ( $byte2 = 216 ; $byte2 < 256 ; $byte2 += 1 )
> { for ( $byte3 = 0 ; $byte3 < 256 ; $byte3 += 16 )
> { print "$byte1.$byte2.$byte3.0\n"; }
> }
> }
>
> Now you get all the known subnet adresses starting from
> 10.216.0.0. You may give amelioration to limit the output to
> the set of adresses you are maintaining. Here you have a
> class A net 10.0.0.0, but you seem to only maintain the set
> of adresses of the subnet 10.216.0.0 with mask 255.255.0.0.
> but it could also be 10.216.0.0 mask 255.254.0.0
> or 10.216.0.0 mask 255.252.0.0
> or 10.216.0.0 mask 255.248.0.0
> and then you need to know this mask to be able to give all
> the existing subnet in your set of adress. But, this is no
> more a perl problem.
>
> Francois Trousset
I sent this in a reply to Tom directly, but maybe this will clarify my
request further:
I'm really looking for an algorithm that will do the or'ing needed with
ANY subnet. Here's what the algorithm should be able to do:
assume a network 10.216.0.0
assume a netmask 255.255.240.0
This is how this should work:
10 .216 .0 .0
00001010 .11001110 .00000000 .00000000
255 .255 .240 .0
11111111 .11111111 .11110000 .00000000
By or'ing this, you get sub-networks of:
10.216.240.0
10.216.224.0
10.216.208.0
10.216.192.0
10.216.176.0
..
..
..
..
10.216.16.0
Now let's assume a netmask of 255.255.216.0 against the same 10.216.0.0
network. This gives us:
255 .255 .216 .0
11111111 .11111111 .11011000 .0
This results in sub-networks of:
10.216.216.0
10.216.208.0
10.216.192.0
10.216.128.0
10.216.88.0
10.216.80.0
10.216.64.0
10.216.24.0
10.216.16.0
10.216.8.0
This is what the or'ing provides. Unfortunately, the algorithm below
doesn't allow for this. I've read some in the Perl manuals about bitwise
or'ing and vectoring and this seems to be the way that I would want to
go, but I'm not sure how to go about doing this. Thanks for the reply.
If you have any other questions or suggestions I would be happy to here
them. Thanks again.
Kevin Martin
NationsBanc - CRT
SMTP/DNS/FIREWALL/UNIX/NT System Admin.
kevinm@crt.com
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". 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 1769
**************************************