[17337] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4759 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 30 06:05:28 2000

Date: Mon, 30 Oct 2000 03:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972903910-v9-i4759@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 30 Oct 2000     Volume: 9 Number: 4759

Today's topics:
    Re: $whatisthis = %hash <bart.lateur@skynet.be>
    Re: ActivePerl under Windoze 98 martin_de_niet@hotmail.com
        Anyone knows a little about www.listsitepro.com ? <jf.poitras@sympatico.ca>
    Re: Bitreverse an integer (Anno Siegel)
    Re: CGI.pm + exec = error <sflitman@xenoscience.com>
    Re: code counter v1 released :-) (CDM)
        combine ksh and perl scripts <ddijk@hetnet.nl>
    Re: combine ksh and perl scripts (Logan Shaw)
    Re: Comparing two files (Tom Christiansen)
    Re: Comparing two files (Tom Christiansen)
    Re: Comparing two files (Martien Verbruggen)
    Re: Encrypting cookies? <sflitman@xenoscience.com>
    Re: even or odd ? (Csaba Raduly)
    Re: grep vs. a subroutine to find an occurance of an el <lr@hpl.hp.com>
    Re: How can i find my ip? (Andrew N. McGuire)
    Re: indirect sub call with strict grey_owl7@my-deja.com
        Is there a more perlish way to write this? <bollinge@wholefamily.com>
    Re: Is there a more perlish way to write this? (Martien Verbruggen)
    Re: Perl/cgi coder salaries <nickco3@yahoo.co.uk>
        PGP module for Activestate? wutang_warrior@my-deja.com
    Re: PGP module for Activestate? <carvdawg@patriot.net>
    Re: Removing line breaks from a string - HELP! (Anno Siegel)
        Sending image into server. <keisari_@hotnail.com>
    Re: TCP Sockets in Perl <uackermann@orga.com>
    Re: What's wrong with this regex? <dlorre@caramail.com>
        Which is the best PERL learning book? <al@bnospamb.cc>
    Re: Working with time <sflitman@xenoscience.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 30 Oct 2000 08:42:50 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: $whatisthis = %hash
Message-Id: <hncqvs4ij81evit0dl3bhbj58apelp567a@4ax.com>

Wayne Collins wrote:

>I am sure it is of no practical use, I am just curious. Could anyone
>explain the output of this code.
>#!/usr/bin/perl -w
>use strict;
>my %hash = qw(1 2 3 4 5 6 7 8);
>my $whatisthis = %hash;
>print $whatisthis;
>
>=========
>Output:
>4/8

But it does have some use. Most of it is for peeking into the internals,
for the curious. See perldata. Here's the relevant excerpt:

 If you evaluate a hash in scalar context, it returns false if the hash
 is empty. If there are any key/value pairs, it returns true; more
 precisely, the value returned is a string consisting of the number of
 used buckets and the number of allocated buckets, separated by a slash.
 This is pretty much useful only to find out whether Perl's internal
 hashing algorithm is performing poorly on your data set. For example,
 you stick 10,000 things in a hash, but evaluating %HASH in scalar
 context reveals `"1/16"', which means only one out of sixteen buckets
 has been touched, and presumably contains all 10,000 of your items. 
 This isn't supposed to happen.

-- 
	Bart.


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

Date: Mon, 30 Oct 2000 07:24:38 GMT
From: martin_de_niet@hotmail.com
Subject: Re: ActivePerl under Windoze 98
Message-Id: <8tj7nj$tue$1@nnrp1.deja.com>

if you have 'x86' sub directory in modules dir rename it to MSWin32-x86-
multi-thread (or whatever platform you have installed) this fixed the
problem on my NT system

Martin

In article <8tcm37$6d1$1@nnrp1.deja.com>,
  schnurmann@my-deja.com wrote:
> Darwin is a wireless ISP and is ssslllloooowwwwwww.  My cable modem at
> home is twice as fast.
>
> I installed Win 2000 on this machine, still ppm doesn't work remotely.
> This did allow for DBI to compile and install though.
>
> In article <39F849A2.DD57DA89@mail.uca.edu>,
>   Cameron Dorey <camerond@mail.uca.edu> wrote:
> > schnurmann@my-deja.com wrote:
> > >
> > > My Windoze 98 machine cannot use ppm to install, but another NT
> machine
> > > around here, running the same version of ActivePerl can.  i think
> it is
> > > related to my being on Darwin, but I am not sure.
> >
> > What is Darwin? A firewall or something? If you download the zipped
> > module from ActiveState
(http://www.ActiveState.com/PPMPackages/zips/)
> > to your hard drive, you can PPM it from there on  Win98 machine -
read
> > the README. If the module is not available for your version/build,
as
> Ed
> > said, and you have done, download and do it manually. I don't know
> where
> > Makefile.pl could be going wrong, I have been lucky enough as yet to
> > only need modules available as PPM or Perl-only ones, where I don't
> have
> > to go through all the manual steps.
> >
> > Cameron
> >
> > --
> > Cameron Dorey
> > Associate Professor of Chemistry
> > University of Central Arkansas
> > Phone: 501-450-5938
> > camerond@mail.uca.edu
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 30 Oct 2000 09:47:25 GMT
From: "Jean-Frédéric Poitras" <jf.poitras@sympatico.ca>
Subject: Anyone knows a little about www.listsitepro.com ?
Message-Id: <NsbL5.82529$oN2.3440786@news20.bellglobal.com>

I have an acocunt at www.listsitepro.com, but i'm wondering how to use the
templates, anyone knows alittle about the List Site Pro templates ?




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

Date: 30 Oct 2000 09:21:19 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Bitreverse an integer
Message-Id: <8tjeif$e8q$1@lublin.zrz.tu-berlin.de>

Logan Shaw <logan@cs.utexas.edu> wrote in comp.lang.perl.misc:
>In article <8tev8c$ap1$1@lublin.zrz.tu-berlin.de>,
>Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:

>>The one possible drawback is that it relies on a fixed integer size
>>(of 32 bits).
>
>That is easy enough to fix.  If you write it in Perl like this:
>
>	$twiddles =
>		[
>			[ 0xffff0000, 0x0000ffff, 16 ],
>			[ 0xff00ff00, 0x00ff00ff, 8 ],
>			[ 0xf0f0f0f0, 0x0f0f0f0f, 4 ],
>			[ 0xcccccccc, 0x33333333, 2 ],
>			[ 0xaaaaaaaa, 0x55555555, 1 ],
>		];
>
>	foreach $twiddle (@$twiddles)
>		{
>		$x = (($x & $twiddle->[0] >> $twiddle->[2])
>			| ($x & twiddle->[1] >> $twiddle->[2]));
>		}
>
>Then, different values of $twiddles will make it work for different bit
>widths.  Since you typically won't use very many different bit widths,
>it's reasonable to dynamically compute $twiddles and cache the
>results.

Ah, dynamic twiddle generation, very promising concept.  It does
bring back a lookup table though.

Anno


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

Date: Mon, 30 Oct 2000 05:14:31 GMT
From: Steve Flitman <sflitman@xenoscience.com>
Subject: Re: CGI.pm + exec = error
Message-Id: <39FD03D5.6B43B08A@xenoscience.com>

Instead of exec'ing the other script, why not load it and eval it?
Then you can catch errors in $@ and use yummy Perl magic
to make tester.pl  do what you want: act as an automated test
harness.  Also see Test::Harness in CPAN.

Steve

andre_sanchez@my-deja.com wrote:

> > Wishing to exec() one CGI script from another is a silly thing to
> > wish.
>
> At the risk of continuing in my sillyness, but with the hope of
> reducing it, I have adjusted my objective; With mixed results.
>
> I have a CGI script (tester.pl) that I wish to have display the output
> of another script (testee.pl). Below are two versions of the testee.pl
> script; version 1 returns the expected results, while version 2
> returns: Malformed multipart POST.
>
> Given that I prefer to use the technique outlined in version 2, your
> ideas on how to eliminate the misbehavior are greatly appreciated.
>
> Thank you,
>
> Andre Sanchez
>
> #--------------------- tester.pl ------------------------------------
> #!/usr/bin/perl -w
>
> use strict;
> use CGI;
>
> my $query = new CGI;
> my ($method, $action, $encoding) =
> ('post', 'tester.pl', 'multipart/form-data');
>
> if (!$query->param('checked')) {
>   print $query->header();
>   print $query->start_html();
>   print $query->startform(-method=>$method,
>                           -action=>$action,
>                           -enctype=>$encoding);
>   print $query->checkbox(-name => 'checked',
>                          -value=> '1',
>                          -label=> 'Check Box');
>   print $query->submit(-value=>'Submit');
>   print $query->endform();
>   print $query->end_html();
> } else {
>   my $one = 1;
>   my $two = 2;
>   open(SHIP, "./testee.pl $one $two |") or die "$!";
>   while(<SHIP>){
>       print;
>   }
> }
>
> #---- testee.pl version 1 returns desired results--------------
> #!/usr/bin/perl -w
>
> use strict;
>
> print "Content-Type: text/html\n\n";
> print "<html><body>Arguments: @ARGV</body></html>";
>
> #---- testee.pl version 2 returns: Malformed multipart POST ---
> #!/usr/bin/perl -w
>
> use strict;
> use CGI;
>
> my $query = new CGI;
> print $query->header();
> print $query->start_html();
> print "Arguments: @ARGV";
> print $query->end_html();
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Mon, 30 Oct 2000 10:05:40 +0100
From: cdemaeyer1@mmm.com (CDM)
Subject: Re: code counter v1 released :-)
Message-Id: <8tjdme$1fb$1@magnum.mmm.com>

comp.lang.perl.announce is the group to use

"Tarael200" <tarael200@aol.com> wrote in message
news:20001027195401.19083.00001297@ng-mk1.aol.com...
> Hey guys :-)
>
> I wasn't entirely sure if this was the right newsgroup to post little
releases
> of perl code to, but here's my perl code counter :)
>
> It skips comments and whitespace and concentrates on that which is
important in
> a source file - the code ! You run it in the form of "perl coc <code
file>" or
> "coc <code file>" if your on a unix machine and you chmod +x it...
>
> When run it outputs the total number of lines, the number of comments, and
the
> number of lines which contain code..
>
> Here's the code:
> #!/usr/bin/perl
> # Code Counter v1.0
> # Counts total lines, lines with code, and number of comments in a
program.
> # coded by iless (tarael200@aol.com)
>
> # v1.00 Notes:
> # o Borrowed Tom Christiansen's code that gets the basename of a program.
> # In this case, coc.
> # o Stole Tom's coding style as well :-) It just looked so professional!
>
> use strict;
>
> # globals
> use vars qw($me $version);
>
> init();
>
> if (scalar(@ARGV) < 1) {
>         usage();
> }
>
> countcode();
>
> ######################### BEGIN SUBROUTINES #########################
> sub init {
>   ($me = $0) =~ s!.*/!!;                        # get basename
>   $| = 1;                                       # autoflush output
>
>   $version = "v1.0";
> }
>
> #########################
> sub usage {
>         die <<EOF
> usage: $me [file]
> EOF
> }
>
> #########################
> sub countcode {
>   # $comments - number of comment lines
>   # $totallines - total number of lines
>   # $codelines - number of lines that are not whitespace or code
>   my (@filetext, $poptext, $comments, $totallines, $codelines);
>
>   open FILEN, "<$ARGV[0]" || die "Can't open file: $!";
>   @filetext = <FILEN>;
>   close FILEN;
>
>   while (scalar @filetext) {
>         $poptext = shift @filetext;
>         $totallines++;
>
>         $poptext =~ s/^\s+//;
>         $poptext =~ s/\s+$//;
>
>         if ($poptext =~ /^#/) {
>                 $comments++;
>                 next;
>         }
>         if ($poptext =~ /^$/) {
>                 next;
>         } else {
>                 # It's some code!
>                 $codelines++;
>         }
>   }
>
> # Output the data:
> print "CodeCounter $version by iless (tarael200\@aol.com) \n";
> print " Counted $totallines lines, $comments comments, and $codelines
lines of
> code.\n";
> }
>
> -------------------- end of code ---------------------
>
> might have gotten word-wrapped a little bit. aol -is- quite disgusting in
that
> area.
>
> -thanks
> Ryan
>
>




Opinions expressed herein are my own and may not represent those of my employer.



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

Date: Mon, 30 Oct 2000 08:23:05 +0100
From: "dick dijk" <ddijk@hetnet.nl>
Subject: combine ksh and perl scripts
Message-Id: <Of0vfNkQAHA.287@net025s>

Does anyone know how to combine a ksh script and a Perl script into a single
script.

I hoped something like the following would work (but it didn't):

#!/bin/ksh
echo "Here go my ksh statements";
#!/usr/bin/perl
print "Here go my Perl statements";

Anyone solved this one already?
Dick




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

Date: 30 Oct 2000 02:43:33 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: combine ksh and perl scripts
Message-Id: <8tjcbl$gh$1@provolone.cs.utexas.edu>

In article <Of0vfNkQAHA.287@net025s>, dick dijk <ddijk@hetnet.nl> wrote:
>Does anyone know how to combine a ksh script and a Perl script into a single
>script.
>
>I hoped something like the following would work (but it didn't):
>
>#!/bin/ksh
>echo "Here go my ksh statements";
>#!/usr/bin/perl
>print "Here go my Perl statements";

It doesn't work because #! only works as the first two characters of
the file, as "man exec" will (or at least should) tell you.

You can do something like this:

	#! /bin/ksh

	echo "I am a happy ksh script!!!"

	perl <<'END_OF_PERL'
	print "And I am a happy Perl script!!!\n";
	END_OF_PERL

	echo "And I am *still* a happy ksh script, even after the"
	echo "happy Perl script is done being itself."

You might want to check the ksh manual page to see that the text inside
the "here-document" isn't subject to interpolation/translation.  I
think I've gotten it right but I'm not sure.

Of course, you can do it the other way around, too:

	#! /usr/local/bin/perl

	print "I am a happy Perl script.\n";

	open (KSH, "| /bin/ksh")
		or die "Can't run ksh because $!\n";
	print KSH << 'END_OF_KSH_SCRIPT';
	echo "I am a happy ksh script."
	END_OF_KSH_SCRIPT
	close KSH;

	print "Still a Perl script...\n";

Hope that helps.

  - Logan


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

Date: 29 Oct 2000 23:01:16 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Comparing two files
Message-Id: <39fd0eac$1@cs.colorado.edu>

In article <8tisln$ogc$1@hermes.nz.eds.com>,
Peter Sundstrom <peter.sundstrom@eds.com> wrote:
>But that's cheating.  

Wrong.

>I need my code to work on Unix and NT without having
>to install something like Cygwin tools.

You're doomed.  Utterly and completely doomed.  Better to cut your
throat now than suffer eternal damnation of reinventing and reinventing
and reinventing in a tool-deprived environment.  

--tom


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

Date: 29 Oct 2000 23:03:30 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Comparing two files
Message-Id: <39fd0f32@cs.colorado.edu>

In article <8tirkh$mft$1@hermes.nz.eds.com>,
Peter Sundstrom <peter.sundstrom@eds.com> wrote:
>I was aware of that, but I was playing safe in case it was on a system that
>doesn't have the -s flag.

Don't go there.  Just.  Don't.  Go.  There.  A surgeon will not
work for a hospital that has unsanitary operating rooms.  No one
should put up with crappy software.  You put the right stuff to get
the job done on the system where it's to be run, and if your lords
and masters of employment don't let you do that, then you walk.
Professionals have basic standards.  They are not slaves.

But do consider:

    $status = system("cmp -s f1 f2");
    $status = system("cmp f1 f2 >/dev/null");


>Slaps hand firmly on forehead.  I can't believe I could miss something so
>obvious.  However, I did look in the Perl Cookbook and did 'perldoc -q
>compare' and didn't come up with File::Compare.  I obviously couldn't see
>the wood for the trees.

The abomination previously known as "perldoc" is not something that
should be mentioned in polite company.  The knee-jerk and wholly
obsequious reliance of people in this newsgroup on that execrable
crap passeth all understanding, respect, and decency.  There are
many better choices, grep being foremost amongst them.  And then,
of course, there's the new "version".

--tom

% perltoc compare
perldelta:=item File::Compare
perlfaq:=item * How does Perl compare with other languages like Java, Python, REXX, Sc
heme, or Tcl?
perlfaq:=item * How can I compare two dates and find the difference?
perlfaq1:=head2 How does Perl compare with other languages like Java, Python, REXX, Sc
heme, or Tcl?
perlfaq4:=head2 How can I compare two dates and find the difference?
perlmodlib:=item File::Compare

% perlhelp compare
perlapi:the number of bytes to compare.  Returns true or false. (A wrapper for
perlapi:indicates the number of bytes to compare.  Returns true or false. (A
perldelta:It is easy to compare such version "numbers" (which are really just plain
perldelta:=item File::Compare
perldelta:comparison functions.  See L<File::Compare>.
perlfaq:=item * How does Perl compare with other languages like Java, Python, REXX, Sc
heme, or Tcl?
perlfaq:=item * How can I compare two dates and find the difference?
perlfaq1:=head2 How does Perl compare with other languages like Java, Python, REXX, Sc
heme, or Tcl?
perlfaq4:=head2 How can I compare two dates and find the difference?
perlfaq4:For example, compare:
perlfaq7:    sub compare($$) {
perlfaq7:    $match = compare("old McDonald", qr/d.*D/i);
perlfaq7:    sub compare($$) {
perlfaq7:    $match = compare("old McDonald", q/($?i)d.*D/);
perlfunc:first argument.  Compare L</split>.
perlfunc:as VERSION.)  Compare with L</use>, which can do a similar check at
perlfunc:    # inefficiently sort by descending numeric compare using
perlfunc:    sub aeq {  # compare two list values
perlfunc:frequencies in the string to be searched--you probably want to compare
perlfunc:    undef $bar{'blurfl'};      # Compare to: delete $bar{'blurfl'};
perlfunc:parse the rest of the file.  Compare with L</require>, which cperllocale:Compare this with the characters that you see and their order if you
perllocale:Compare this with a similar but locale-aware program:
perlmodlib:=item File::Compare
perlmodlib:Compare files or filehandles
perlmodlib:Compare 8-bit scalar data accoperlop:not a good idea.  Here's a (relatively expensive) work-around to compare
perlre:is backtracked (compare L<"Backtracking">), all changes introduced after
perlre:value of C<$^R> is restored if the assertion is backtracked; compare
perlref:useful thing to be done with this is to compare two references
perlref:    if ($ref1 == $ref2) {  # cheap numeric compare of references
perlrun:except that the B<-i> form doesn't need to compare $ARGV to $oldargv to
perlvar:C<$#+>, the number of subgroups in the regular expression.  Compare
perlvar:last successful match.  Compare with the C<@+> variable.
perlxstut:Compare with L<"Getting the fat out of XSUBs"> for a similar
tradeoff of


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

Date: Mon, 30 Oct 2000 20:21:14 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Comparing two files
Message-Id: <slrn8vqfca.ac5.mgjv@martien.heliotrope.home>

On 29 Oct 2000 23:03:30 -0700,
	Tom Christiansen <tchrist@perl.com> wrote:
> 
> The abomination previously known as "perldoc" is not something that
> should be mentioned in polite company.  The knee-jerk and wholly
> obsequious reliance of people in this newsgroup on that execrable
> crap passeth all understanding, respect, and decency.  There are
> many better choices, grep being foremost amongst them.  And then,
> of course, there's the new "version".

Oh, come on, Tom. perldoc is perfectly useable for most beginning users
and many cursory uses of the documentation. At least it gives everyone
who has Perl installed a common way to get to the manual. It makes it
easier for this group to communicate the eternal phrase "RTFM and here's
where to find it". 

I use man. Everyone on unix-like systems hopefully does. I use grep.
Everyone on unix-like systems hopefully does. And if I ever found myself
in the situation that I had to work on a tool-poor system, I'd install
these tools, and many others, myself. 

However, I do not feel like having to explain to each person who isn't
used to having man, grep, sed and awk around what 

# man perl

means. I also don't feel like saying it and leaving it unexplained. I
also am not going to tell people where to get these tools, or
substitutes of them and how to install it, simply because I don't feel
it has anything to do with this group. 

perldoc is a tool that is distributed with Perl. Everyone who has Perl
has perldoc. That is its strength. Yes, it has flaws. No, it isn't
always the most appropriate tool to search the documentation. So what?

I know you're not going to agree with me on this, and I know you
probably have heard these arguments before. Just ignore it, and assume
I'm just saying this for other people reading this. But if you get on
the soapbox, and start being unreasonable, you can expect some protest.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd.   | ain't.
NSW, Australia                  | 


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

Date: Mon, 30 Oct 2000 05:23:45 GMT
From: Steve Flitman <sflitman@xenoscience.com>
Subject: Re: Encrypting cookies?
Message-Id: <39FD0600.E3664D91@xenoscience.com>


--------------B81D2E1CE6EF74D2EDB0D667
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

It could just be a simple substitution cipher.  I think it is interesting
that most of the letters are in the A-J range.  Don't know what that
Y is doing there.  It probably is a number in base 10, upshifted:

my $x='ABGKBJFYJCLBAGMJHGACGAGH';
for ($d=1; $d<=24; $d++) {
  print "$d: ";
  for ($i=0; $i<length($x); $i++) {
   my $c=ord(substr($x,$i,1));
   print chr($c-$d);
  }
  print "\n";
}

results in

1: @AFJAIEXIBKA@FLIGF@BF@FG
2: ?@EI@HDWHAJ@?EKHFE?AE?EF
3: >?DH?GCVG@I?>DJGED>@D>DE
4: =>CG>FBUF?H>=CIFDC=?C=CD
5: <=BF=EATE>G=<BHECB<>B<BC
6: ;<AE<D@SD=F<;AGDBA;=A;AB
7: :;@D;C?RC<E;:@FCA@:<@:@A
8: 9:?C:B>QB;D:9?EB@?9;?9?@
9: 89>B9A=PA:C98>DA?>8:>8>?
10: 78=A8@<O@9B87=C@>=79=7=>
11: 67<@7?;N?8A76<B?=<68<6<=
12: 56;?6>:M>7@65;A><;57;5;<
13: 45:>5=9L=6?54:@=;:46:4:;
14: 349=4<8K<5>439?<:935939:
15: 238<3;7J;4=328>;98248289
16: 127;2:6I:3<217=:87137178
17: 016:195H92;106<976026067
18: /059084G81:0/5;865/15/56
19: ./48/73F709/.4:754.04.45
20: -.37.62E6/8.-39643-/3-34
21: ,-26-51D5.7-,28532,.2,23
22: +,15,40C4-6,+17421+-1+12
23: *+04+3/B3,5+*06310*,0*01
24: )*/3*2.A2+4*)/520/)+/)/0

Choice 17 has a base-10 time at its end,
which sure seems meaningful in the context
of a cookie:

«1:45» c:\utl> perl -e "print scalar localtime(976026067);"
Tue Dec  5 07:21:07 2000

Cheers!

Steve

Steve wrote:

> Hey folks,
>         on some web pages I see them sending back cookies as follows:
>
> ASPSESSIONIDQQQQQQPD=ABGKBJFYJCLBAGMJHGACGAGH
>
> What do you need to use to achive such encryption. I know it is simple
> but that's all I need rather than making it too obvious.
>
> Cheers,
> Steve

--------------B81D2E1CE6EF74D2EDB0D667
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
It could just be a simple substitution cipher.&nbsp; I think it is interesting
<br>that most of the letters are in the A-J range.&nbsp; Don't know what
that
<br>Y is doing there.&nbsp; It probably is a number in base 10, upshifted:
<p><tt>my $x='</tt>ABGKBJFYJCLBAGMJHGACGAGH'<tt>;</tt>
<br><tt>for ($d=1; $d&lt;=24; $d++) {</tt>
<br><tt>&nbsp; print "$d: ";</tt>
<br><tt>&nbsp; for ($i=0; $i&lt;length($x); $i++) {</tt>
<br><tt>&nbsp;&nbsp; my $c=ord(substr($x,$i,1));</tt>
<br><tt>&nbsp;&nbsp; print chr($c-$d);</tt>
<br><tt>&nbsp; }</tt>
<br><tt>&nbsp; print "\n";</tt>
<br><tt>}</tt>
<p>results in
<p><tt>1: @AFJAIEXIBKA@FLIGF@BF@FG</tt>
<br><tt>2: ?@EI@HDWHAJ@?EKHFE?AE?EF</tt>
<br><tt>3: >?DH?GCVG@I?>DJGED>@D>DE</tt>
<br><tt>4: =>CG>FBUF?H>=CIFDC=?C=CD</tt>
<br><tt>5: &lt;=BF=EATE>G=&lt;BHECB&lt;>B&lt;BC</tt>
<br><tt>6: ;&lt;AE&lt;D@SD=F&lt;;AGDBA;=A;AB</tt>
<br><tt>7: :;@D;C?RC&lt;E;:@FCA@:&lt;@:@A</tt>
<br><tt>8: 9:?C:B>QB;D:9?EB@?9;?9?@</tt>
<br><tt>9: 89>B9A=PA:C98>DA?>8:>8>?</tt>
<br><tt>10: 78=A8@&lt;O@9B87=C@>=79=7=></tt>
<br><tt>11: 67&lt;@7?;N?8A76&lt;B?=&lt;68&lt;6&lt;=</tt>
<br><tt>12: 56;?6>:M>7@65;A>&lt;;57;5;&lt;</tt>
<br><tt>13: 45:>5=9L=6?54:@=;:46:4:;</tt>
<br><tt>14: 349=4&lt;8K&lt;5>439?&lt;:935939:</tt>
<br><tt>15: 238&lt;3;7J;4=328>;98248289</tt>
<br><tt>16: 127;2:6I:3&lt;217=:87137178</tt>
<br><tt>17: 016:195H92;106&lt;976026067</tt>
<br><tt>18: /059084G81:0/5;865/15/56</tt>
<br><tt>19: ./48/73F709/.4:754.04.45</tt>
<br><tt>20: -.37.62E6/8.-39643-/3-34</tt>
<br><tt>21: ,-26-51D5.7-,28532,.2,23</tt>
<br><tt>22: +,15,40C4-6,+17421+-1+12</tt>
<br><tt>23: *+04+3/B3,5+*06310*,0*01</tt>
<br><tt>24: )*/3*2.A2+4*)/520/)+/)/0</tt>
<p>Choice 17 has a base-10 time at its end,
<br>which sure seems meaningful in the context
<br>of a cookie:
<p><tt>&laquo;1:45&raquo; c:\utl> perl -e "print scalar localtime(976026067);"</tt>
<br><tt>Tue Dec&nbsp; 5 07:21:07 2000</tt>
<p>Cheers!
<p>Steve
<p>Steve wrote:
<blockquote TYPE=CITE>Hey folks,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on some web pages I see
them sending back cookies as follows:
<p>ASPSESSIONIDQQQQQQPD=ABGKBJFYJCLBAGMJHGACGAGH
<p>What do you need to use to achive such encryption. I know it is simple
<br>but that's all I need rather than making it too obvious.
<p>Cheers,
<br>Steve</blockquote>
</html>

--------------B81D2E1CE6EF74D2EDB0D667--



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

Date: Mon, 30 Oct 2000 10:29:45 +0000 (UTC)
From: real.email@signature.this.is.invalid (Csaba Raduly)
Subject: Re: even or odd ?
Message-Id: <8FDD68F66quuxi@194.203.134.135>

A million monkeys weren't enough! It took NOSPAM.billy@easynet.be 
(Billy) on 29 Oct 2000 to produce <39fc1359.100122189@news.easynet.be>:

>Hello !
>
>Does an instruction exist which can test if an number is odd (eg 1, 3,
>5, ...) or even (eg 2, 4, 6, 8, ...) ?
>

David Steuber, are you listening ?
:-)

-- 
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com      http://www.sophos.com/
US Support +1 888 SOPHOS 9      UK Support +44 1235 559933
Life is complex, with real and imaginary parts.


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

Date: Mon, 30 Oct 2000 00:51:57 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: grep vs. a subroutine to find an occurance of an element in a list
Message-Id: <MPG.1466d68b2bfc21ed98ae7b@nntp.hpl.hp.com>

In article <slrn8vn6q0.ib.sjs@ragnar.sympatico.ca>, sjs@yorku.ca says...
> Randy Harris <harrisr@bignet.net> wrote:

 ...

> If it's a vanilla HP install, it may very well have a carcass of a camel
> (version 4) rather than a live, breathing one.
> 
> I think in that case you keep your job; we ought to start sacking people 
> at HP who think it's funny to package a buggy, eight year-old version of
> software that they can acquire for free.

It isn't funny, it's lazy (which according to some Larry or other is a 
virtue).  The Perl 4.036 bundled with HP-UX is intended only for use in 
compiling and maintaining the OS.  It works for that purpose, so why 
bother to update it (and to retest the things it is being used for)?

Similarly, the OS is bundled with a fairly braindead ancient C compiler, 
again for internal use.  If the programmer needs a good general-purpose 
C compiler, HP will be glad to sell its ANSI C, or the programmer can 
compile gcc for free.

If the programmer needs an uptodate Perl, the programmer can compile it 
for free.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 30 Oct 2000 00:02:12 -0600
From: anmcguire@ce.mediaone.net (Andrew N. McGuire)
Subject: Re: How can i find my ip?
Message-Id: <873dhe7tp7.fsf@hawk.ce.mediaone.net>

>>>>> "NG" == Nathan Going <nathangoing@yahoo.com> writes:

NG> i know that.
NG> </michael> wrote in message
NG> news:ibejvsssvo7lmu1bfn3gh3j6mdt94aiv8d@4ax.com...
>> Ipconfig at the dos prompt
>> 
>> 
>> On Fri, 27 Oct 2000 12:08:32 +0200, "Nathan Going"
>> <nathangoing@yahoo.com> wrote:
>> 
>> >How do i discover my internet ip address?

Please do not post upside down... To answer your original question...

perldoc -q "IP address"


anm

-- 
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$;
'


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

Date: Mon, 30 Oct 2000 10:29:43 GMT
From: grey_owl7@my-deja.com
Subject: Re: indirect sub call with strict
Message-Id: <8tjiih$6k2$1@nnrp1.deja.com>

Thanks for the tip, Nick.  But with your code I still get:
   syntax error at ./test_subcall.pl line 9, near "->("

Viktor

In article <39F85C34.2477F7BB@yahoo.co.uk>,
  Nick Condon <nickco3@yahoo.co.uk> wrote:
> grey_owl7@my-deja.com wrote:
>
> > P.S. Please reply to email address.
>
> No. Post to newsgroup read in newsgroup.
>
> > #!/usr/bin/perl5 -w
> >
> > use strict;
> >
> > sub Bingo() {print "It's Bingo!\n"}
> > sub Bongo() {print "No, it's Bongo!\n"}
> > my $beg = "Bi";
> > my $full = $beg."ngo";
> > &$full();
> > print "1 $full\n";
> >
> > $beg = "Bo";
> > $full = ($beg).("ngo");
> > print "2 $full\n";
> >
> > &{$full};
> > print "\n";
> >
> > __END__
> >
> > Results without "use strict;":
> >         It's Bingo!
> >         1 Bingo
> >         2 Bongo
> >         No, it's Bongo!
> >
> > Results with "use strict;":
> >         Can't use string ("Bingo") as a subroutine ref while "strict
refs" in use at
> > ./test_subcall.pl line 9.
>
> You're storing the name of the function in a variable. This is a
symbolic reference not
> a hard reference, they are forbidden by 'use strict'.
>
> Symbolic references are a bad idea, they aren't reference counted, and
they can't access
> lexical variables only global ones, they don't include package
information so if
> executed in a different package the wrong function would be called.
>
> Use a hash with hard references in it instead:
>
> #!/usr/local/bin/perl -w
> use strict;
>
> my %func = (
>     "Bingo" => sub {print "It's Bingo!\n"},
>     "Bongo" => sub {print "No, it's Bongo!\n"}
> );
>
> my $beg = "Bi";
> my $full = $beg."ngo";
> $func{$full}->();
> print "1 $full\n";
>
> $beg = "Bo";
> $full = ($beg).("ngo");
> print "2 $full\n";
>
> $func{$full}->();
> print "\n";
>
> __END__
> Results:
>
> It's Bingo!
> 1 Bingo
> 2 Bongo
> No, it's Bongo!
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 30 Oct 2000 10:56:33 +0200
From: "Shimon Bollinger" <bollinge@wholefamily.com>
Subject: Is there a more perlish way to write this?
Message-Id: <39fd37f0@news.barak.net.il>

I need to test if a variable has a value in a particular range:

    if ($n >= 30 && $n < 40) {
        # ...
    }

This code is 1) clear and 2) works.  But it looks very C/C++ to me.  Is
there a more perlish way to write this test?

Thanks.

Shimon Bollinger
Manager, Technical Services
WholeFamily.com
Real Families ~ Real Issues ~ Real Solutions
972-2-653-7040 x41
972-2-653-7038 fax
webmaster@wholefamily.com
http://www.wholefamily.com







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

Date: Mon, 30 Oct 2000 21:24:46 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Is there a more perlish way to write this?
Message-Id: <slrn8vqj3e.ac5.mgjv@martien.heliotrope.home>

On Mon, 30 Oct 2000 10:56:33 +0200,
	Shimon Bollinger <bollinge@wholefamily.com> wrote:
> I need to test if a variable has a value in a particular range:
> 
>     if ($n >= 30 && $n < 40) {
>         # ...
>     }
> 
> This code is 1) clear and 2) works.  But it looks very C/C++ to me.  Is
> there a more perlish way to write this test?

It's as Perlish as it needs to be. But there's been talk to add this
syntax to Perl 6:

if (30 <= $n < 40)
{
    # do stuff
}

I must say, I'd like that.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia                  | 


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

Date: Mon, 30 Oct 2000 10:13:55 +0000
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: Perl/cgi coder salaries
Message-Id: <39FD49E3.8390056F@yahoo.co.uk>

Tarael200 wrote:

> Very recently, within the past day I think, there was a job advertisement for a
> perl/cgi programmer, for $25-30/hour.
>
> Someone posted $50-90 was the going salary, as of a 1997 survey.
>
> My friend, you are quite wrong IIRC, for then they were rare. Now, they are but a
> dime a dozen.
>
> Anyone care to comment?
>
> -Ryan

Yeah, I wouldn't get out of bed for 20 pounds/hour.



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

Date: Mon, 30 Oct 2000 08:19:28 GMT
From: wutang_warrior@my-deja.com
Subject: PGP module for Activestate?
Message-Id: <8tjaue$9h$1@nnrp1.deja.com>

Hi.

I use activestate 5.6 and 5.00x
I need a PGP module of some sort, activestate don't seem to have one.
How/where can I get one?

C.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 30 Oct 2000 05:25:43 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: PGP module for Activestate?
Message-Id: <39FD4CA7.79AE11B1@patriot.net>

I don't know how well this functions with the various
builds of ActiveState Perl....

http://user.intersatx.net/hopwoodg/

wutang_warrior@my-deja.com wrote:

> Hi.
>
> I use activestate 5.6 and 5.00x
> I need a PGP module of some sort, activestate don't seem to have one.
> How/where can I get one?
>
> C.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.




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

Date: 30 Oct 2000 09:36:06 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Removing line breaks from a string - HELP!
Message-Id: <8tjfe6$ear$1@lublin.zrz.tu-berlin.de>

Godzilla! <godzilla@stomp.stomp.tokyo> wrote in comp.lang.perl.misc:
>alphazerozero@my-deja.com wrote:
>> Godzilla! wrote:

>> > more than an ignorant illiterate troll using myriad
>> > fake names with psychotic malice intent.
> 
>> I am fairly certain that should be
> 
>> ... using _a_ myriad _of_ fake ....
>
>Amusing how you insist on displaying both your ignorance
>and illiteracy in myriad ways. Never use " a " and " of "
>with myriad, both are implied by definition of myriad.

That's an unusual property of "myriad" you just invented there.

  Main Entry: myr·i·ad
  Pronunciation: 'mir-E-&d
  Function: noun
  Etymology: Greek myriad-, myrias, from myrioi countless, ten thousand
  1 : ten thousand
  2 : a great number <a myriad of ideas> 
                      ^^^^^^^^^^^^^^^^^
Anno


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

Date: Mon, 30 Oct 2000 12:34:05 +0200
From: foo <keisari_@hotnail.com>
Subject: Sending image into server.
Message-Id: <39FD4E9D.131D779D@hotnail.com>

I would need a script, that would send file from my PC to a server.
I have Perl in both machines.
Image size is about 120kb.

I have thought someting like that:

1. read image into scalar (in my PC).

2. send it into a cgi file with post method as http (maybe with LWP).

3. read the <STDIN> into a scalar with cgi-script (in server).

4. print the scalar into a file.


But the problem is that i dont know how to do it exactly.
The biggest problem is sending file with post method.
Would you tell me.

Joonas.



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

Date: Mon, 30 Oct 2000 08:22:40 +0100
From: Ulrich Ackermann <uackermann@orga.com>
Subject: Re: TCP Sockets in Perl
Message-Id: <39FD21C0.14903701@orga.com>

Simon Jefford wrote:
> 
> I'm having immense difficulty with the following :
> 
> The task is to connect to a server in order to make a stock enquiry. The
> enquiry is made using a custom protocol developed by a third party. The
> conversation should go like this:
> 
> Stock Server    :       Hello
> Perl Client             :       Authentication
> Stock Server    :       Authentication Successful
> Perl Client             :       Request for Stock Level
> Stock Server    :       Stock Level
> 
> I can make the connection fine (using the IO::Socket::INET module). When
> I read from the socket I get the hello after about five minutes. Which
> obviously isn't good enough. I then send the authentication details by
> printing to the socket. That works fine (or at least it seems to). When I
> read from the socket (i.e. $reply = <$socket>) it returns straightaway but
> $reply is empty.
> 
> When I telnet to the server I get the hello message almost straight away.
> I can't test sending stuff using telnet because the protocol involves
> things like SOH (Ascii 1) which I find a bit difficult to type(!)
> 
> Does anyone have any pointers as to where the problem could be? I can't
> be more specific at the moment, because the code is at work. Has anyone
> come across anything which sounds similar.
> 
> Many thanks,
>         Simon

Hi Simon,
I am a Perl novice, but I had similar problems and as far they are
connected with your Perl Client they could be solved (maybe) setting $|
for your socket.
In addition you can read perldoc perlipc and of course the Perl
Cookbook, wich provides some very useful stuff concerning IPC.

HTH, Ulrich
-- 
Ulrich Ackermann
ORGA Kartensysteme GmbH (SY-PEAT-STA)
Tel.:+49.5254.991-925 
mailto:uackermann@orga.com



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

Date: Mon, 30 Oct 2000 08:47:16 GMT
From: Dominique Lorre <dlorre@caramail.com>
Subject: Re: What's wrong with this regex?
Message-Id: <8tjcik$2fj$1@nnrp1.deja.com>

In article <39FCAB13.15D27DC8@ot.com.au>,
  Ian Boreham <ianb@ot.com.au> wrote:
> Dominique Lorre wrote:
>
> > $some_variable = $1 + $2/$3
> >
> > when $3 is zero you will get an error.
>
> True, but the code below gives an incorrect answer, when an error is
> preferable.
>
Not here, you should first look at what is doing the code before giving
your opinion.

> > foreach $other_variable(@examples) {
> > $some_variable = -1 ; # undef marker
> > $some_variable = $3?$1+$2/$3:$1
>
> At least the way I see this (and it may look different on your
screen...),
> you are setting $some_variable twice, making the first useless. The
second
> time, $1, $2, $3 are not yet set, and are therefore not going to give
you
> the answer you want (maybe you intended to put them in a single-quoted
> string for a later eval?) Even if you sort out these problems, if $3
== 0,
> you will return just the integer portion, which is incorrect. If $2
were
> zero, that would be correct, but wouldn't need to be a special case.
If $3
> is zero, arithmetic won't give you the right answer - all you can do
is
> return an error value or "die".
>
First, you should read the (only!) comment in the code. Even if it was
incorrect you would have an idea of what is going here. Then you should
read the second line and notice there is no ';' character, thus the
code line is not ended. The correct line was:
$some_variable = $3?$1+$2/$3:$1
if ($other_variable =~ |\d{2} [A-Za-z]{3} (\d*) (\d*)/*(\d*)|);

This makes much more sense. I put -1 in other variable to check if it
has been set later. Such programming practice is part of what is
called 'defensive programming' and is not useless (see the Murphy's Law
for details ;). $1, $2 and $3 are set correctly here. I know it is
confusing but I had to split the line somewhere to keep the regexp
intact.

> > if ($other_variable =~ |\d{2} [A-Za-z]{3} (\d*) (\d*)/*(\d*)|);
>
> All these "*"s worry me. If you really want to match a number, make
them
> "+"s. Otherwise you could end up with empty strings and interpret
them as
> zeroes without realising. If you want to make the slash optional, you
> should use "?", not "*". However, this will still allow two
> whitespace-separated integers, which is meaningless in this context
(and
> would result in $3 being set to 0, which would then cause
$some_variable to
> be set to $1 only, ignoring the erroneous second integer, but only if
the
> overall order of the code were corrected in the first place).
>
> > print "$some_variable = $some_variable\n" ;
>
> This will print the value twice. You should escape the first "$".
>
I am not sure to understand what you mean. I am new to Perl and maybe
this expression is not perfect but it seems to work (at least it worked
for the examples given by OP).

> (My interpretation of the code here is not tested, but it doesn't
look like
> the code was tested in the first place...)
The code was tested but I had to make a few changes on the fly (see
Murphy's Law for why ;).

My interpretation is that you don't have readen the original post and
you don't know what this program does or what is supposed to do. Your
suppositions concerning $1, $2 and $3 are incorrect and computer
science is not made of suppositions.
Regards



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 30 Oct 2000 00:59:01 -0800
From: Peter <al@bnospamb.cc>
Subject: Which is the best PERL learning book?
Message-Id: <o0eqvskrm8t1k2gbouv75d8prblk75hqdf@4ax.com>

Is it the Camel  book or the llama book or Beginning PERL?
I am trying to learn perl. Does perl have a brigth future? How about
php?




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

Date: Mon, 30 Oct 2000 05:25:17 GMT
From: Steve Flitman <sflitman@xenoscience.com>
Subject: Re: Working with time
Message-Id: <39FD065B.D23ED863@xenoscience.com>

Ack!  Use Date::Calc, don't reinvent the wheel.
It has very nice delta functions.

Steve

Mario wrote:

> In article <39fc1449$1@nexus.comcen.com.au>,
>   "Kiel Stirling" <taboo@comcen.com.au> wrote:
> >
> > Is there an easy way to subtract time ?
> >
> > well what I meen is if I had an end time of 13:59:00 hours
> > and a period of 02:48:20 hours is there an easy way to get the
> > start time ??
> >
> I don't know of a single command to do this but I am a newbie.I would
> use something like this.
>
> $tme[0]="xx:yy:zz";#end time
> $tme[1]="xx:yy:zz";#period
>
> for ($i=0;$i<2;$i++) {
>    @part=split(/[:]/,$tme[$i]);
>    $seconds[$i]=$part[0]*3600+$part[1]*60+$part[2];
> }
>
> $start_seconds=$seconds[0]-$seconds[1];
> $hours=int($start_seconds/3600);
> $minutes=int(($start_seconds%3600)/60);
> $seconds=$start_seconds-($hours*3600+$minutes*60);
> $start_time="$hours:$minutes:$seconds";
>
> --
> Mario
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4759
**************************************


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