[17665] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5085 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 12 00:05:36 2000

Date: Mon, 11 Dec 2000 21:05:12 -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: <976597511-v9-i5085@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 11 Dec 2000     Volume: 9 Number: 5085

Today's topics:
        backslashing char classes (was Re: combining regexps in (Tad McClellan)
        Can we have left side info of subs, as 'split' does? <johnlin@chttl.com.tw>
    Re: Can we have left side info of subs, as 'split' does (Garry Williams)
    Re: Can we have left side info of subs, as 'split' does <tinamue@zedat.fu-berlin.de>
    Re: Can we have left side info of subs, as 'split' does <jeffp@crusoe.net>
    Re: Can we have left side info of subs, as 'split' does (Garry Williams)
        DOCUMENT_UR <laoxiu100@hotmail.com>
    Re: downloading perl <carvdawg@patriot.net>
    Re: Faster than LWP (David Efflandt)
    Re: Faster than LWP <elijah@workspot.net>
    Re: How do I find out my own IP Address? <nebur@wish.net>
        How to execute an external Perl script in a Perl script <chk1213@yahoo.com>
    Re: HTTPS::Cookies <webmaster@duckpaw.com>
    Re: HTTPS::Cookies <mbjorkman1@qwest.net>
        huh ?? <Waarddebon@chello.nl>
    Re: huh ?? <jhelman@wsb.com>
    Re: huh ?? (Garry Williams)
    Re: huh ?? (Richard Zilavec)
    Re: huh ?? <Waarddebon@chello.nl>
    Re: lwp <ng@fnmail.com>
    Re: Need help to replace passwd - New at this ! msalerno@my-deja.com
    Re: net:: (David Efflandt)
    Re: Newbie s/// problem (Brcin)
    Re: Newbie s/// problem <jeffp@crusoe.net>
    Re: Newbie s/// problem (Brcin)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 11 Dec 2000 21:33:08 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: backslashing char classes (was Re: combining regexps into one)
Message-Id: <slrn93b73k.12q.tadmc@maxim.metronet.com>

Garry Williams <garry@ifr.zvolve.net> wrote:
>On Mon, 11 Dec 2000 17:45:40 GMT, eggrock@my-deja.com
><eggrock@my-deja.com> wrote:
>
>>Let me try this again with what I really mean to post...
>>
>>while(/href=['"]?([a-z_0-9\-\.:\/\#]+)/gi) {
>>   print "$1\n";
>>}
>
>Again, the character class does *not* treat `.' or `#' in a special
>way.  They do not need to be quoted in a character class.

>When you quote
>unnecessarily, it serves to confuse.


In our never ending quest to vanquish confusion wherever it rears
its ugly head, let us summarize the doctrine of backslashing in 
character classes:

There are only 4 characters that are meta in a character class.

There are a few other chars that may need backslashing, but
that is a consequence of something beyond the character class
itself.


The 4 char class metacharacters:

   ]    # ends the char class, unless it is first

   -    # forms a range, unless first or last in class

   ^    # negates the class only if it is first in class

   \    # so we can escape things


You may need to backslash the pattern delimiter (but that is
outside of the char class).

You may need to backslash $ and @ characters (but that is due
to interpolation, also outside of the char class).


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


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

Date: Tue, 12 Dec 2000 09:50:53 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Can we have left side info of subs, as 'split' does?
Message-Id: <9140oh$e1e@netnews.hinet.net>

Dear all,

When I consulted perldoc -f split, I saw:

    split /PATTERN/,EXPR,LIMIT

    When assigning to a list, if LIMIT is omitted, Perl supplies a
    LIMIT one larger than the number of variables in the list, to
    avoid unnecessary work.

    In time critical applications it behooves you not
    to split into more fields than you really need.

Great!!!
It means 'split' has the information of the left side of sub calling.

    ($one,$two) = split;  # 'split' knows the left side has 2 elements

Can we also do that?
The first thought that came to my mind was 'wantarray'.

    sub foo { print wantarray }
    $zero = foo;
    ($one) = foo;
    ($one,$two) = foo;
    ($one,$two,$three) = foo;
    @infinite = foo;

__END__
1111    # not 0123-1

So 'wantarray' is not the answer.

I wonder what kind of information does 'split' use.
If it is available to users, it would be great.

Is it the only way to pass the number as an argument?

    $zero = foo(0);
    ($one) = foo(1);
    @infinite = foo(-1);

Or there is other facility available?

Thank you.

John Lin





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

Date: Tue, 12 Dec 2000 03:09:24 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Can we have left side info of subs, as 'split' does?
Message-Id: <EFgZ5.612$uF3.42261@eagle.america.net>

On Tue, 12 Dec 2000 09:50:53 +0800, John Lin <johnlin@chttl.com.tw> wrote:
>When I consulted perldoc -f split, I saw:
>
>    split /PATTERN/,EXPR,LIMIT
>
>    When assigning to a list, if LIMIT is omitted, Perl supplies a
>    LIMIT one larger than the number of variables in the list, to
>    avoid unnecessary work.
>
>    In time critical applications it behooves you not
>    to split into more fields than you really need.
>
>Great!!!
>It means 'split' has the information of the left side of sub calling.
>
>    ($one,$two) = split;  # 'split' knows the left side has 2 elements
>
>Can we also do that?
>The first thought that came to my mind was 'wantarray'.
>
>    sub foo { print wantarray }
>    $zero = foo;
>    ($one) = foo;
>    ($one,$two) = foo;
>    ($one,$two,$three) = foo;
>    @infinite = foo;
>
>__END__
>1111    # not 0123-1
>
>So 'wantarray' is not the answer.

Yes it is.  

    $ cat x
    #!/usr/local/bin/perl -w
    use strict;
--> sub foo { print wantarray, "\n" }
    my $zero = foo;
    my ($one) = foo;
    my ($two, $three, @infinite);
    ($one,$two) = foo;
    ($one,$two,$three) = foo;
    @infinite = foo;
    $ perl x
-->
    1
    1
    1
    1
    $

-- 
Garry Williams


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

Date: 12 Dec 2000 03:27:11 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Can we have left side info of subs, as 'split' does?
Message-Id: <9145uf$31pde$2@fu-berlin.de>

hi,
Garry Williams <garry@ifr.zvolve.net> wrote:
> On Tue, 12 Dec 2000 09:50:53 +0800, John Lin <johnlin@chttl.com.tw> wrote:
>>When I consulted perldoc -f split, I saw:
>>
>>    split /PATTERN/,EXPR,LIMIT
>>
>>    When assigning to a list, if LIMIT is omitted, Perl supplies a
>>    LIMIT one larger than the number of variables in the list, to
>>    avoid unnecessary work.
>>
>>    In time critical applications it behooves you not
>>    to split into more fields than you really need.
>>
>>Great!!!
>>It means 'split' has the information of the left side of sub calling.

nope. look:
split /PATTERN/, $string
splits into as many fields as possible and returns the array.
split /PATTERN/, $string, 3
splits just into 3 fields and puts the rest into the last field.

and by the way:
perldoc -f wantarray

hth,
tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: Mon, 11 Dec 2000 22:41:29 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Can we have left side info of subs, as 'split' does?
Message-Id: <Pine.GSO.4.21.0012112240050.19179-100000@crusoe.crusoe.net>

On Dec 12, Garry Williams said:

>On Tue, 12 Dec 2000 09:50:53 +0800, John Lin <johnlin@chttl.com.tw> wrote:
>>When I consulted perldoc -f split, I saw:
>>
>>    When assigning to a list, if LIMIT is omitted, Perl supplies a
>>    LIMIT one larger than the number of variables in the list, to
>>    avoid unnecessary work.
>>
>>It means 'split' has the information of the left side of sub calling.
>>Can we also do that?
>>The first thought that came to my mind was 'wantarray'.
>
>Yes it is.  

No, it's not.  We currently have no way of knowing how many arguments a
function is expected to return.  That might actually be a nice thing to
have.  Your test just shows what wantarray is meant to show.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/



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

Date: Tue, 12 Dec 2000 04:10:59 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Can we have left side info of subs, as 'split' does?
Message-Id: <nzhZ5.619$uF3.42707@eagle.america.net>

On Mon, 11 Dec 2000 22:41:29 -0500, Jeff Pinyan <jeffp@crusoe.net> wrote:
>On Dec 12, Garry Williams said:
>
>>On Tue, 12 Dec 2000 09:50:53 +0800, John Lin <johnlin@chttl.com.tw> wrote:
>>>When I consulted perldoc -f split, I saw:
>>>
>>>    When assigning to a list, if LIMIT is omitted, Perl supplies a
>>>    LIMIT one larger than the number of variables in the list, to
>>>    avoid unnecessary work.
>>>
>>>It means 'split' has the information of the left side of sub calling.
>>>Can we also do that?
>>>The first thought that came to my mind was 'wantarray'.
>>
>>Yes it is.  
>
>No, it's not.  We currently have no way of knowing how many arguments a
>function is expected to return.  That might actually be a nice thing to
>have.  Your test just shows what wantarray is meant to show.

Oh.  Now I see what the original poster wanted.  

-- 
Garry Williams


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

Date: Tue, 12 Dec 2000 09:22:28 +0900
From: "sang" <laoxiu100@hotmail.com>
Subject: DOCUMENT_UR
Message-Id: <913qns$pt4$1@nn-os102.ocn.ad.jp>

Hi,
I have a perl script that needs the DOCUMENT_URI var from the SSI that
called it but it is never returned.
I made a simple .shtml that echos the DOCUMENT_URI env and it works.
Any Ideas.

Thanks inadvance





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

Date: Mon, 11 Dec 2000 21:43:36 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: downloading perl
Message-Id: <3A3590D8.E8530AC4@patriot.net>

Well, since Perl 6 isn't available yet, I guess not.

If you mean Perl 5.6, well, I looked at it this way...since the
ActiveState site
makes it obscenely easy to download the latest version of ActivePerl,
which
is 5.6, the original poster would have had to actually dig around for
build 522.
Therefore, it would seem to me that he was intent on using that
particular
version, and since he offered no explanation either way, I opted to
assist him
in his endeavor.

Bart Lateur wrote:

> H C wrote:
>
> >You should have downloaded Api522e.exe.
>
> Isn't that 5.005? Shouldn't he be getting 6 something?
>
> --
>         Bart.

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




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

Date: Tue, 12 Dec 2000 01:12:17 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Faster than LWP
Message-Id: <slrn93aurr.2ed.efflandt@efflandt.xnet.com>

On Mon, 11 Dec 2000, BUCK NAKED1 <dennis100@webtv.net> wrote:
>Is there a faster way to grab a URL than using LWP? I've tried get and
>getstore from LWP/Simple and LWP/UserAgent. These methods appear to take
>so long that my webserver is timing out before grabbing the URL.
>
>I read the FAQ, and saw Tom Christiansen's example of a way to grab a
>URL 100X faster, but couldn't figure out how to put a scalar reference
>to it for storage. Also, Tom seems to say that his 100X faster method
>isn't always effective.

I haven't actually tried LWP, so I do not know if it is sluggish or if
that is a characteristic of the server you are trying to access.  But if
all you want to do is GET, 'perldoc perlipc' gives an example of a
'webget' script that uses IO::Socket.  But you may want to add a Host:
header if possibly accessing a virtual host.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: 12 Dec 2000 01:52:57 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: Faster than LWP
Message-Id: <eli$0012112030@qz.little-neck.ny.us>

In comp.lang.perl.misc, David Efflandt <efflandt@xnet.com> wrote:
> On Mon, 11 Dec 2000, BUCK NAKED1 <dennis100@webtv.net> wrote:
> >Is there a faster way to grab a URL than using LWP? I've tried get and
> >getstore from LWP/Simple and LWP/UserAgent. These methods appear to take
> >so long that my webserver is timing out before grabbing the URL.

You probably have other problems then.

> I haven't actually tried LWP, so I do not know if it is sluggish or if
> that is a characteristic of the server you are trying to access.  But if
> all you want to do is GET, 'perldoc perlipc' gives an example of a
> 'webget' script that uses IO::Socket.  But you may want to add a Host:
> header if possibly accessing a virtual host.

For /SPEED/ you want to minimize modules, function calls, etc.
This is not fully optimized for speed, but I find it pretty
snappy. (It is from a larger script that does 'lynx -dump' type
stuff, including running Benchmark::timethis over sets of
URLs.)

A sample call:

grab('www.yahoo.com', 80, \'GET / HTTP/1.0', \<<"REQESThead", 0, 1, 0);
Host: www.yahoo.com\cM
User-Agent: my fun toy\cM
\cM
REQESThead

And the code:

use Socket;

$tcpproto = getprotobyname('tcp');

#####################################################
# Grab an html page. Needs a remote hostname, a port number
# a first line request (eg "GET / HTTP/1.0"), and the remainder
# of the request (empty string if HTTP/0.9).
sub grab ($$$$$$$) {
  my ($remote, $port, $request, $heads, $printhead, $printbody, $no_optimize) = @_;
  my ($iaddr, $paddr, $line);
  my $out = '';
  my $len;
  my $rc;

  if (!($iaddr = inet_aton($remote))) { 
    return &err444("no host: $remote", $printhead, $printbody);
  }

  $paddr   = sockaddr_in($port, $iaddr);

  print 'Peer is ' .  inet_ntoa($iaddr) . ":$port\n" if $debug;

  if (!socket(SOCK, PF_INET, SOCK_STREAM, $tcpproto)) {
    return &err444("socket: $!", $printhead, $printbody);
  }
  if (!connect(SOCK, $paddr)) {
    return &err444("connect: $!", $printhead, $printbody);
  }

  $len = length($$request);
  $rc = syswrite(SOCK, $$request, $len);

  if ($rc != $len) {
    warn("request write to $remote was short ($rc != $len)\n");

  } else {
    $len = length($$heads);
    $rc = syswrite(SOCK, $$heads, $len);

    warn("heads write to $remote was short ($rc != $len)\n")
    	if ($rc != length($$heads));
  }

  $nosignal = 1;

  while ($line = &saferead() and $nosignal) {
    $out .= $line;
    last if ($line =~ /^\015?\012?$/);
  }

  print $out if $printhead;

  # Don't optimize not printing the body if we are in benchmark mode.
  if (!$printbody and !$no_optimize) {
    close (SOCK)            || die "close: $!";
    return $out;
  }

  if ($out =~ /\nContent-Length:\s+(\d+)/) {
    # OLD store everything way :
    ## read(SOCK,$out,$1,length($out));
    # New dump immediately way :
    my $tograb = $1;
    my $chunk  = 512;	# not too large, since it is off the network
    my $buf;
    my $rc;

    while($tograb >= $chunk) {
      $buf = '';
      $rc = read(SOCK,$buf,$chunk,0);
      print $buf if $printbody;
      if ($rc != $chunk) {
        warn "Return from $remote read was short (got $rc of $chunk)\n";
	return $out;
      }

      $tograb -= $chunk;
    }

    if ($tograb > 0) {
      $buf = '';
      $rc = read(SOCK,$buf,$tograb,0);
      print $buf if $printbody;
      if ($rc != $tograb) {
        warn "Return from $remote read was short (got $rc of $tograb)\n";
	return $out;
      }
    }

  } else {

    $nosignal = 1;
    # Back to line by line mode.
    while (defined($line = <SOCK>) and $nosignal) {
      # OLD store every way : $out .= $line;
      print $line if $printbody;
    }
  }

  close (SOCK)            || die "close: $!";
  return $out;
} # end &grab


#####################################################
# Attempt to read a line safely from SOCK filehandle.
sub saferead () {
  my $line;
  eval {
  	local$SIG{ALRM} = sub { die 'timeout!' };
	alarm 15;
	$line = <SOCK>;
	alarm 0;
       };
  if ($@ and $@ !~ /timeout!/) {warn("during socket read: $@\n")}
  return $line;
} # end &saferead 


Elijah
------
has a library of browsers to emulate the headers of


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

Date: Tue, 12 Dec 2000 01:42:06 +0100
From: "nebur" <nebur@wish.net>
Subject: Re: How do I find out my own IP Address?
Message-Id: <3a3574cc@excalibur.gbmtech.net>

It's a bit lame but how about parsing the output of the IPCONFIG command,
this should work relatively well on NT systems,

for example IPCONFIG /ALL displays information on all adapters including
PPP,

Hope it helps (eventhough it's pretty lame, but it's late and I didn't want
to spend my whole night on trying something less lame), if I figure out
something else I'll let you know,

nebur

<<< Small step for *NIX, giant leap for PC's >>>

"Christoph" <cvh@gmx.de> wrote in message news:3A31F7CA.49D48720@gmx.de...
> Tony Curtis wrote:
> >
> > >> On Fri, 8 Dec 2000 20:09:13 -0500,
> > >> "Randy Harris" <harrisr@bignet.net> said:
> >
> > > Dave Brondsema <brondsem@my-deja.com> wrote in message
> > > news:90rsip$dt7$1@nnrp1.deja.com...
> > >> In article <3A3165FF.A1434D27@gmx.de>, Christoph
> > >> <cvh@gmx.de> wrote: > Hello, > > could anybody tell me
> > >> how to find out the IP-address that my >
> > >> internet-provider gives me at dial-up?  > I allready
> > >> searched CPAN but I couldn't find anything that looks
> > > like
> > >> a > solution.  >





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

Date: Tue, 12 Dec 2000 03:30:37 -0000
From: Hank <chk1213@yahoo.com>
Subject: How to execute an external Perl script in a Perl script
Message-Id: <t3b6utega6lh5e@corp.supernews.com>

I have tried to find the answer from the news group, but I still couldn't 
make it work as the way I wanted.

What I am trying to do:
First, I know I can use this HTML code to execute a single perl script -

<A HREF="problem.cgi">Go to this Problem </A>

It's fine. But my problem is that I also want to write a status flag into 
a flat file before I execute this Perl script. So, that means I had to use 
some way like FORM, to "Submit" an "Action". In the "Action", I can 
implement the status flag file written and execute the Perl script 
"problem.cgi". I tried to use Exec() or System() to execute the Perl 
script, like -

Exec ("problem.cgi");
or 
System ("problem.cgi");

What I got was a MS-DOS screen, then program seems hanging there forever.

By the way, I am running Perl in Window 95 environment.

Your help is much needed and thanks in advance.

Hank

--
Posted via CNET Help.com
http://www.help.com/


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

Date: Mon, 11 Dec 2000 18:13:04 -0500
From: "Ryan Buterbaugh - DuckPaw.com" <webmaster@duckpaw.com>
Subject: Re: HTTPS::Cookies
Message-Id: <3a355fb8@news.nauticom.net>

if i remember correctly, do you even need a library for cookies?  can you
just have something like this:
print "Set-Cookie: name=NAME; expires=EXPIRATION; path=PATH; domain=DOMAIN;
secure\n\n";
and put secure there if you want it to only be over a HTTPS connection?
--
Ryan Buterbaugh
webmaster@duckpaw.com
Resources for the serious webmaster
www.duckpaw.com

<apacheproblems@my-deja.com> wrote in message
news:9132pq$j1k$1@nnrp1.deja.com...
>
>
> I am trying to obtain the following libraries for the following:
>
> use LWP::UserAgent;
> use HTTPS::Cookies;
>
> $ua = new LWP::UserAgent;
> $ua->cookie_jar(new HTTPS::Cookies);
>
> $req = new HTTPS::Request 'GET', 'https://www.company.com';
>
>
> As I have a piece of code (as shown) that uses the above libraries. I
> currently have donwloaded and installed  Crypt-SSLeay-0.17 and libwww
> but there seems to be another piece missing. WHich modules do I need to
> dowload? I can't seem to find HTTPS module in CPAN.
>
> Can anybody help please.
>
> thanks
>
> -a
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Mon, 11 Dec 2000 17:54:30 -0800
From: "Ice Demon" <mbjorkman1@qwest.net>
Subject: Re: HTTPS::Cookies
Message-Id: <vFfZ5.506$Jd7.503861@news.uswest.net>

When using LWP, you aren't setting a cookie but recieving a cookie (What you
have is for sending a cookie). LWP just lets a program pretend to be a
browser. (As a example) If he is trying to retrieve a webpage that won't let
him have it unless he recieves a cookie first, he would need to use the part
of the LWP module for recieving that cookie. I had to use this once to have
a program login in to a site to retrieve the webpage in the protected area.

"Ryan Buterbaugh - DuckPaw.com" <webmaster@duckpaw.com> wrote in message
news:3a355fb8@news.nauticom.net...
| if i remember correctly, do you even need a library for cookies?  can you
| just have something like this:
| print "Set-Cookie: name=NAME; expires=EXPIRATION; path=PATH;
domain=DOMAIN;
| secure\n\n";
| and put secure there if you want it to only be over a HTTPS connection?
| --
| Ryan Buterbaugh
| webmaster@duckpaw.com
| Resources for the serious webmaster
| www.duckpaw.com
|
| <apacheproblems@my-deja.com> wrote in message
| news:9132pq$j1k$1@nnrp1.deja.com...
| >
| >
| > I am trying to obtain the following libraries for the following:
| >
| > use LWP::UserAgent;
| > use HTTPS::Cookies;
| >
| > $ua = new LWP::UserAgent;
| > $ua->cookie_jar(new HTTPS::Cookies);
| >
| > $req = new HTTPS::Request 'GET', 'https://www.company.com';
| >
| >
| > As I have a piece of code (as shown) that uses the above libraries. I
| > currently have donwloaded and installed  Crypt-SSLeay-0.17 and libwww
| > but there seems to be another piece missing. WHich modules do I need to
| > dowload? I can't seem to find HTTPS module in CPAN.
| >
| > Can anybody help please.
| >
| > thanks
| >
| > -a
| >
| >
| > Sent via Deja.com http://www.deja.com/
| > Before you buy.
|
|




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

Date: Tue, 12 Dec 2000 04:01:16 GMT
From: "Waarddebon" <Waarddebon@chello.nl>
Subject: huh ??
Message-Id: <gqhZ5.194864$nj7.2185605@Flipper>

$a1 has the value: 'hello'
$a2 has the value: 'there'

I want to combine these 2 values to a variable called $temp which then gets
the value: 'hellothere' (without a space)

I tried to do this with:
$temp=$a1.$a2;
print $temp;

But the variable $temp doesn't contain anything then...
Can anyone help me with this ?




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

Date: Tue, 12 Dec 2000 04:19:16 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: huh ??
Message-Id: <3A35A751.9FF17AAD@wsb.com>

Waarddebon wrote:
> 
> $a1 has the value: 'hello'
> $a2 has the value: 'there'
> 
> I want to combine these 2 values to a variable called $temp which then gets
> the value: 'hellothere' (without a space)
> 
> I tried to do this with:
> $temp=$a1.$a2;
> print $temp;

You got me.  Given the following code:

$a1 = 'hello';
$a2 = 'there';

## Some other stuff?  I trust that it doesn't modify $a1 and $a2.

$temp=$a1.$a2;
print $temp;

This prints "hellothere" as expected under 5.6.0.  Could this be an
output buffering problem?  Have you tried setting $| to a non-zero value
so that the print call actually prints immediately?  Sorry, but that's
all I can think of.

> But the variable $temp doesn't contain anything then...
> Can anyone help me with this ?

Hope this helps,
JH
 
----------------------------------------------------------------
Jeff Helman                 Product Manager -- Internet Services
jhelman@wsb.com                    CCH Washington Service Bureau
----------------------------------------------------------------



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

Date: Tue, 12 Dec 2000 04:20:25 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: huh ??
Message-Id: <dIhZ5.622$uF3.42707@eagle.america.net>

On Tue, 12 Dec 2000 04:01:16 GMT, Waarddebon <Waarddebon@chello.nl> wrote:
>$a1 has the value: 'hello'
>$a2 has the value: 'there'
>
>I want to combine these 2 values to a variable called $temp which then gets
>the value: 'hellothere' (without a space)
>
>I tried to do this with:
>$temp=$a1.$a2;
>print $temp;

I guess you're not telling us everything.  It works for me: 

    $ cat x
    #!/usr/local/bin/perl -lw
    use strict;
    my $a1   = 'hello';
    my $a2   = 'there';
    my $temp = $a1 . $a2;
    print $temp;
    $temp = "$a1$a2";
    print $temp;
    $ perl x
    hellothere
    hellothere
    $

-- 
Garry Williams


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

Date: Tue, 12 Dec 2000 04:43:06 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: huh ??
Message-Id: <3a35abc4.348734196@news.tcn.net>

On Tue, 12 Dec 2000 04:01:16 GMT, "Waarddebon" <Waarddebon@chello.nl>
wrote:

>$temp=$a1.$a2;
>print $temp;

This works fine for me.....

$a1 = 'hello';
$a2 = 'there';

$temp = $a1 . $a2;
print $temp . "\n";

hellothere

Are you sure $a1 and $a2 contain the words hello and there?  Try
printing them before putting them in $temp.

if($debug) { print "a1 = $a1 a2 = $a2\n"; }
$temp = $a1 . $a2;
print $temp . "\n";


--
 Richard Zilavec
 rzilavec@tcn.net


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

Date: Tue, 12 Dec 2000 04:44:49 GMT
From: "Waarddebon" <Waarddebon@chello.nl>
Subject: Re: huh ??
Message-Id: <53iZ5.195658$nj7.2186766@Flipper>

Well this is the actual code, I really hope you can help me...

$temp=$a1.$a2;
$string = "temp=" . $temp . "&a1=" . $a1 . "&a2=" . $a2 . "&a3=" . $a3 .
"&a4=" . $a4 . "&a5=" . $a5 . "&b1=" . $b1 . "&b2=" . $b2 . "&b3=" . $b3 .
"&c1=" . $c1 . "&c2=" . $c2 . "&d1=" . $d1 . "&e1=" . $e1 . "&e2=" . $e2 .
"&e3=" . $e3 . "&f1=" . $f1 . "&f2=" . $f2;
dbmopen(%DB, "/data/database/sell", 0664) || die $!;
$DB{$temp} = $string;
dbmclose(%DB);





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

Date: Mon, 11 Dec 2000 21:15:18 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: Re: lwp
Message-Id: <914588$kk7$1@info1.fnal.gov>

how do I use A4proxy to see what URLs are loaded

--
Enrico Ng <ng@fnmail.com>
"Enrico Ng" <ng@fnmail.com> wrote in message
news:910rmb$p73$1@info1.fnal.gov...
> umm, how do I do that?
>
> --
> Enrico Ng <ng@fnmail.com>
> "matteo" <dsdf@sdfd.com> wrote in message news:3a3366a9@post.usenet.com...
> > **** Post for FREE via your newsreader at post.usenet.com ****
> >
> > try to use a4proxy to see what urls are loaded
> >
> > "Enrico Ng" <ng@fnmail.com> ha scritto nel messaggio
> > news:90u74i$c12$1@info1.fnal.gov...
> > > I dont know if this is possible, but I want to make a script that will
> > login
> > > to my online bank acount and display my balance.
> > > the problem is that the form that is used to login is a asp script.
> > > I tryed just putting ?usename=enricong&password=...
> > > but that didnt work.
> > >
> > > any ideas?
> > >
> > > --
> > > Enrico Ng <ng@fnmail.com>
> > >
> > >
> >
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> >  *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
> >                       http://www.usenet.com
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>




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

Date: Tue, 12 Dec 2000 04:07:45 GMT
From: msalerno@my-deja.com
Subject: Re: Need help to replace passwd - New at this !
Message-Id: <9148ae$iss$1@nnrp1.deja.com>

In article <_6cZ5.154$B9.170600448@news.frii.net>,
  cfedde@fedde.littleton.co.us (Chris Fedde) wrote:
> In article <Y4cZ5.153$B9.187359744@news.frii.net>,
> Chris Fedde <cfedde@fedde.littleton.co.us> wrote:
> >In article <913ffc$uha$1@nnrp1.deja.com>,  <msalerno@my-deja.com>
wrote:
> >>I am working on a script that will allow me to change the password
of a
> >>user.  Here is the problem, I cannot use the passwd command.  I
need to
> >>edit the /etc/passwd file.  What I am looking to do is to change the
> >>password for a particular user.  I do not need to encrypt the
password
> >>since I will be using a default pre-encrypted password.
> >
> >On my system
> >
> >    perl -F: -lapi.bak -e '
> >        s/^cfedde:[^:]+:/cfedde:ddsElcoX/00Ns:/
>
> Of course that should have been
>
>         s{^cfedde:[^:]+:}{cfedde:ddsElcoX/00Ns:}
>
> >    ' /etc/master.passwd
> >
> --
>     This space intentionally left blank
>

I appreciate the feedback, but I would like to understand what exactly
it is doing to the passwd file.  It would be even more appreciated it
you did.

Thanks,

Matt

perl -F: -lapi.bak -e '
s{^cfedde:[^:]+:}{cfedde:ddsElcoX/00Ns:}
' /etc/master.passwd


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


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

Date: Tue, 12 Dec 2000 01:22:20 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: net::
Message-Id: <slrn93avel.2ed.efflandt@efflandt.xnet.com>

On Mon, 11 Dec 2000, EnIgMaBoM <enigmabomb@home.snip.nospam.com> wrote:
>Dually Noted, But where would the domain name go?

Since $host is the only variable in my example other that $ip, can't you
guess?  Actually it should be a complete hostname including the domain.  
A domain alone does not necessarily resolve to an IP (it might or might
not).

>"David Efflandt" <efflandt@xnet.com> wrote in message
>news:slrn939fnb.1oc.efflandt@efflandt.xnet.com...
>> On Mon, 11 Dec, EnIgMaBoM <enigmabomb@home.afraid.of.spam.com> wrote:
>> >will net::: do backwards translation from a domain to an IP addy?
>>
>> I think you mean forward translation, reverse lookup is when you resolve a
>> domain name for a given IP.  I don't know what net::: is, but you can
>> resolve a name to an IP with:
>>
>> $ip = join(".",unpack("C4",scalar gethostbyname($host)));
>>
>> --
>> David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
>> http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
>> http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/
>
>


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/


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

Date: Mon, 11 Dec 2000 23:25:38 GMT
From: info@sz-brkini.si (Brcin)
Subject: Re: Newbie s/// problem
Message-Id: <SndZ5.802$0k3.2238@news.siol.net>

uri@sysarch.com (Uri Guttman) wrote in <x7lmtmk7qj.fsf@home.sysarch.com>:

>>>>>> "B" == Brcin  <info@sz-brkini.si> writes:
>
>  B> If I write $temp =~ s/.{5}$//; why it doesn't work if intead of {5}
>  B> I write {$blah}? $blah = 10
>
>define doesn't work. it works for me. show some input, and expected and
>real output.
>
>uri
>

$len = length (@link[1]);

$len2 = $len / 2;


if ($len > 25)

{

    @link[1] =~ s/.{$len2}$/.../;

}

print "@link[1]\n";

Basically it should cut half of the string if it is too long.. But it just 
doesn't work.. If I add a $len2 = 20; before the if statement, for example, 
it works fine.. What's the catch?



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

Date: Mon, 11 Dec 2000 18:32:06 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Newbie s/// problem
Message-Id: <Pine.GSO.4.21.0012111830040.19179-100000@crusoe.crusoe.net>

[posted & mailed]

On Dec 11, Brcin said:

>$len = length (@link[1]);
>$len2 = $len / 2;
>
>if ($len > 25) {
>    @link[1] =~ s/.{$len2}$/.../;
>}
>
>print "@link[1]\n";

You should be using $link[1] there instead of @link[1].

Anyway, the problem is most likely that $len2 is not an integer:

  $x = 7/2;
  print "foobar" =~ /.{$x}/;

That has no output.

  $x = int(7/2);
  print "foobar" =~ /.{$x}/;

That prints "foo".

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/



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

Date: Tue, 12 Dec 2000 00:37:52 GMT
From: info@sz-brkini.si (Brcin)
Subject: Re: Newbie s/// problem
Message-Id: <AreZ5.803$0k3.2343@news.siol.net>

japhy@pobox.com (Jeff Pinyan) wrote in <Pine.GSO.4.21.0012111830040.19179-
100000@crusoe.crusoe.net>:

>[posted & mailed]
>
>On Dec 11, Brcin said:
>
>>$len = length (@link[1]);
>>$len2 = $len / 2;
>>
>>if ($len > 25) {
>>    @link[1] =~ s/.{$len2}$/.../;
>>}
>>
>>print "@link[1]\n";
>
>You should be using $link[1] there instead of @link[1].
>
>Anyway, the problem is most likely that $len2 is not an integer:
>
>  $x = 7/2;
>  print "foobar" =~ /.{$x}/;
>
>That has no output.
>
>  $x = int(7/2);
>  print "foobar" =~ /.{$x}/;
>
>That prints "foo".
>

Thanx a lot! That int() does it :)



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

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


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