[9412] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3012 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 30 13:57:20 1998

Date: Tue, 30 Jun 98 10:45:16 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 30 Jun 1998     Volume: 8 Number: 3012

Today's topics:
    Re: How to check variables exists in a string (Mark-Jason Dominus)
    Re: How to check variables exists in a string <edwarton@ml.com>
    Re: How to check variables exists in a string <edwarton@ml.com>
    Re: How to check variables exists in a string <quednauf@nortel.co.uk>
    Re: How to check variables exists in a string <edwarton@ml.com>
    Re: How to check variables exists in a string <edwarton@ml.com>
    Re: How to check variables exists in a string <quednauf@nortel.co.uk>
    Re: How to check variables exists in a string (Craig Berry)
    Re: How to check variables exists in a string (Craig Berry)
    Re: How to check variables exists in a string <tchrist@mox.perl.com>
    Re: How to check variables exists in a string (Craig Berry)
    Re: How to check variables exists in a string (Ronald J Kimball)
    Re: How to check variables exists in a string (Ronald J Kimball)
    Re: How to check variables exists in a string <edwarton@ml.com>
        how to flush network connections <delian@ntrl.net>
        How to give input to HSQL command <alain.lamartiniere@bellsygma.com>
    Re: How to give input to HSQL command <david.x.corcoran@boeing.com>
    Re: how to know the limit of a perl array? (Mark-Jason Dominus)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 28 Jun 1998 15:15:44 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: How to check variables exists in a string
Message-Id: <6n64p0$7ao$1@monet.op.net>
Keywords: bath creak hew incorporable


In article <ltogvfotc7.fsf@asfast.com>, Lloyd Zusman  <ljz@asfast.com> wrote:
>I'm not sure whether this is what you (Tony Edwardson) are thinking
>of, but perhaps you're wondering if there's a way in Perl to make use
>of something similar to the following sh/bash/ksh construct:
>
>  xxx="Result: ${var:-UNDEFINED}"
>
>In case something like this is what you're looking for in Perl, one way
>to accomplish something similar is ...
>
>  $xxx = "Result: ${\eval{defined($var)?$var:'UNDEFINED'}}";  


Hey, that is a great use for the Interpolation module that I hadn't
thought of before:


	use Interpolation d => \&default_if_undef;

	$x = 1;  

	print "x is $d{$x,UNDEFINED}; y is $d{$y,UNDEFINED}; z is $d{$z}.\n";

	# Prints ``x is 1; y is UNDEFINED; z is undef''

	sub default_if_undef { 
          my ($v, $x) = split /$;/o, $_[0]; 
	  defined($v) ? $v : defined($x) ? $x : 'undef' 
	}


I guess you could fix it so that you could omit the dollar signs:

	print "x is $d{x,UNDEFINED}; y is $d{y,UNDEFINED}; z is $d{z}.\n";

or even make it look shell-like:

	print "x is $d{x:-UNDEFINED}; y is $d{y:-UNDEFINED}; z is $d{z}.\n";

but then it won't work on `my' variables.


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

Date: Mon, 29 Jun 1998 09:45:01 +0100
From: Tony Edwardson <edwarton@ml.com>
Subject: Re: How to check variables exists in a string
Message-Id: <3597540D.8F02BCE7@ml.com>

Thanks for that but it is obvious from the replies received that I didn't explain
myself very well.

The scalar in question is obtained from a database and can contain any text with
any variables embeded within.
So I don't know which variables are going to be there.

What I am looking for is some way to parse a scalar for embeded perl variables and
check if it is defined or not.

Tony

Aidan Rogers wrote:

> Tony Edwardson <edwarton@ml.com> wrote:
> : Anyone got any ideas how to check that perl variables embeded in a
> : string are defined?
>
> : e.g.
>
> : A scalar contains
>
> : $scalar="/home/user/$group/$book/$yy$mmm$yy";
>
> : I want to expand the embeded perl veriables with their values in some
> : way such that I
> : can check that each variable is defined
>
> I'm not sure if I have the exact gist of what you are saying. What do you want
> to happen if the variable is not defined?
>
> I do something similar when constructing sql queries, but it basically boils
> down to this.
>
> my $scalar = "the root of the statement";
> $scalar .= "$the_next_bit" if defined($the_next_bit);
>
> and so on. I don't know if that will be useful to you, unless you set a
> default for $group and $book etc in case they aren't defined.
>
> Try doing something like
>
> $book ||= $default_for_book;
> $group ||= $default_for_group;
>
> that way if $book is defined it will keep its value, else it will take a
> default value.
>
> Hope this helps.
>
> Aidan





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

Date: Mon, 29 Jun 1998 10:11:56 +0100
From: Tony Edwardson <edwarton@ml.com>
Subject: Re: How to check variables exists in a string
Message-Id: <35975A5B.F1E5C92@ml.com>

To explain my problem better.

The system I am maintaining/rewriting makes use of a sybase database
containing a lot of configuration information which,
in a lot of cases, contains perl variables.
I am hitting a lot of problems in rewriting the code when I rename variables
to more appropriate names only to find that the old
variable name is used within on of these database fields and so things go
wrong.
I am looking for a mechanism to parse a string for any embeded perl variables
and then check whether they are currently defined.
I will be wanting to build up a list of undefined variables and then croaking
with a message detailing those found.

Is this any clearer ?

Tony

Craig Berry wrote:

> Tony Edwardson (edwarton@ml.com) wrote:
> : Anyone got any ideas how to check that perl variables embeded in a
> : string are defined?
> :
> : e.g. a scalar contains
> :
> : $scalar="/home/user/$group/$book/$yy$mmm$yy";
> :
> : I want to expand the embeded perl veriables with their values in some
> : way such that I can check that each variable is defined using eval
> : i.e. eval "$result = \"$scalar\"";
> :
> : it expands everthing it can but provides no way of checking that all
> : variables are defined.
>
> What form of checking do you want?  Dieing or issuing a warning would be
> relatively easy.  Generating a list of undefined variables would be a bit
> harder, but doable.  Provide your spec and I'll see what I can do.
>
> ---------------------------------------------------------------------
>    |   Craig Berry - cberry@cinenet.net
>  --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
>    |      Member of The HTML Writers Guild: http://www.hwg.org/
>        "Every man and every woman is a star."





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

Date: Mon, 29 Jun 1998 11:46:16 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: How to check variables exists in a string
Message-Id: <35977078.788ECB80@nortel.co.uk>

Mark-Jason Dominus wrote:
> 
> In article <ltogvfotc7.fsf@asfast.com>, Lloyd Zusman  <ljz@asfast.com> wrote:
> >I'm not sure whether this is what you (Tony Edwardson) are thinking
> >of, 

I was wondering about something else, in fact it is a regexp question. Based on
the idea of looking for possible variables in a string I tried to construct a
regular expression to match possible candidates:

$c = 0;
$_ = '$hello, %var, @array, $another$together%andmore.@hello';
  $c++ if /[\$%@].+?[,\.\s\$%@]/g;
print $c;

Which I thought would hopefully match a thing starting with $,%,@, followed by 1
or more characters, matched in non-greedy style, followed by a , . whitespace $
% or @. And this globally. However, $c is 1 after the operation. Anyone has the
nerve and patience to tell me what I am doing wrong?

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Mon, 29 Jun 1998 11:59:48 +0100
From: Tony Edwardson <edwarton@ml.com>
Subject: Re: How to check variables exists in a string
Message-Id: <359773A4.A484CC0D@ml.com>

You've pointed me in the right direction
I'm ended up with

while ($scalar =~ /\${?(\w+)}?/) {
 $varname = $1;
 if (defined $$varname) {
  $scalar =~ s/\${?(\w+)}?/$$varname/;
 }
 else {
  croak "\$$varname in $scalar is not defined\n";
 }
}

One problem with this solution is that I' can no longer 'use strict'
because if the variable to be expanded is declared with 'my'
then $$varname doesn't find it
i.e.

1 use strict;
2 no strict "refs";
3 my $string =  'here is $foo in this string';
4 my $foo = 'bar';
5  while ($scalar =~ /\${?(\w+)}?/) {
6   my $varname = $1;
7   if (defined $$varname) {
8    $string =~ s/\${?(\w+)}?/$$varname/;
9   }
10   else {
11    croak "\$$varname in \"$string\" is not defined\n";
12   }
13  }

Yields
$foo in "here is $foo in this string" is not defined;

Whereas

1 $string =  'here is $foo in this string';
2 $foo = 'bar';
3  while ($scalar =~ /\${?(\w+)}?/) {
4   my $varname = $1;
5   if (defined $$varname) {
6    $string =~ s/\${?(\w+)}?/$$varname/;
7   }
8   else {
9    croak "\$$varname in \"$string\" is not defined\n";
10   }
11  }

Yields
here is bar in this string

Any ideas how I can get this to work with 'use strict' ?

Tony


Tom Phoenix wrote:

> On Fri, 26 Jun 1998, Tony Edwardson wrote:
>
> > Anyone got any ideas how to check that perl variables embeded in a
> > string are defined?
>
> That's what the defined() function tests.
>
> > I want to expand the embeded perl veriables with their values in some
> > way such that I can check that each variable is defined
>
>     if (grep !defined($_), $group, $book, $yy, $mmm) {
>         warn "Oops, at least one of them isn't defined.\n";
>     } else {
>         $scalar="/home/user/$group/$book/$yy$mmm$yy";
>     }
>
> Hope this helps!
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/





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

Date: Mon, 29 Jun 1998 14:05:46 +0100
From: Tony Edwardson <edwarton@ml.com>
Subject: Re: How to check variables exists in a string
Message-Id: <3597912A.D57C44AE@ml.com>

he problem is your use of the /g modifier to a regular expression match.

Your 'if' statement will only return true once and so will only increment $c once -
hence you get 1 returned.

You need something like this

$c = 0;
$_ = '$hello, %var, @array, $another$together%andmore.@hello';

while (m/([\$%@]\w+)\b/g) {
 $c++;
 my $curr_pos = pos $_; # Get the current position in the string
 pos $_ = $curr_pos; # Move the match on to the current position
}


I hope this helps

Tony

-------------------------
Tony Edwardson
Merrill Lynch Europe PLC
0171-906 7587
edwarton@ml.com


F.Quednau wrote:

> Mark-Jason Dominus wrote:
> >
> > In article <ltogvfotc7.fsf@asfast.com>, Lloyd Zusman  <ljz@asfast.com> wrote:
> > >I'm not sure whether this is what you (Tony Edwardson) are thinking
> > >of,
>
> I was wondering about something else, in fact it is a regexp question. Based on
> the idea of looking for possible variables in a string I tried to construct a
> regular expression to match possible candidates:
>
> $c = 0;
> $_ = '$hello, %var, @array, $another$together%andmore.@hello';
>   $c++ if /[\$%@].+?[,\.\s\$%@]/g;
> print $c;
>
> Which I thought would hopefully match a thing starting with $,%,@, followed by 1
> or more characters, matched in non-greedy style, followed by a , . whitespace $
> % or @. And this globally. However, $c is 1 after the operation. Anyone has the
> nerve and patience to tell me what I am doing wrong?
>
> --
> ____________________________________________________________
> Frank Quednau
> http://www.surrey.ac.uk/~me51fq
> ________________________________________________





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

Date: Mon, 29 Jun 1998 15:14:41 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: How to check variables exists in a string
Message-Id: <3597A151.C788412C@nortel.co.uk>

Tony Edwardson wrote:
> 
> The problem is your use of the /g modifier to a regular expression match.
> 
> Your 'if' statement will only return true once and so will only increment $c once -
> hence you get 1 returned.
 
> $c = 0;
> $_ = '$hello, %var, @array, $another$together%andmore.@hello';
> 
> while (m/([\$%@]\w+)\b/g) {
>  $c++;
>  my $curr_pos = pos $_; # Get the current position in the string
>  pos $_ = $curr_pos; # Move the match on to the current position
> }
> 

Excellent. Thanks. However, you've just opened yourself to a question tirade :)

This script now works:

$c = 0;
$_ = '$hello, %var, @array, $another$together%andmore.@hello';

while (m/([\$%@]\w+)\b/g) {
 $c++;
 push @vars, $1;
}
print "$c matches\n";
for (@vars) {print "$_\n";}

- - - - 

>  my $curr_pos = pos $_; # Get the current position in the string
>  pos $_ = $curr_pos; # Move the match on to the current position

What is the point of those expressions? I took them out, because they didn't
make much sense too me, and they don't seem to affect anything.

And what exactly is actually a word boundary? Ah, sorry, it is in the perlre
page:

 ...defined as a spot between two characters that has a \w on one side of it and
and a \W on the other side of it (in either
order), counting the imaginary characters off the beginning and end of the
string as matching a \W...

Cheers.


-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: 29 Jun 1998 15:45:59 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to check variables exists in a string
Message-Id: <6n8crn$ljp$2@marina.cinenet.net>

Tony Edwardson (edwarton@ml.com) wrote:
: To explain my problem better.
: 
: The system I am maintaining/rewriting makes use of a sybase database
: containing a lot of configuration information which,
: in a lot of cases, contains perl variables.

So field values in this database might contain strings like

  Hi $person this is $app and your bill is $bill

or whatever, and you want to know if any of $person, $app, or $bill are
undefined, right?  That still leaves the question of how the undefined
ones are *reported*.  In other words, suppose we posit a subroutine named
find_undefs_in_string, or fuis() for short.  If I call

  fuis('Hi $person this is $app and your bill is $bill');

what is the return value you want, if (say) $app is defined but the other
two aren't?

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 29 Jun 1998 15:53:28 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to check variables exists in a string
Message-Id: <6n8d9o$ljp$3@marina.cinenet.net>

F.Quednau (quednauf@nortel.co.uk) wrote:
: This script now works:
: 
: $c = 0;
: $_ = '$hello, %var, @array, $another$together%andmore.@hello';
: 
: while (m/([\$%@]\w+)\b/g) {

No need for the \b above; \w+ will by definition read until it hits a
non-\w, so you'll automatically be at a word boundary when it finishes
matching.

:  $c++;
:  push @vars, $1;
: }
: print "$c matches\n";

Rather than using the separate $c counter variable, why not ditch it
entirely and just use

  print scalar @vars, " matches\n";

here?

For that matter, you can eliminate the entire loop (or make it implicit,
really) by rewriting it as

  @vars = m/([\$%@]\w+)/g;

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 29 Jun 1998 16:18:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to check variables exists in a string
Message-Id: <6n8enp$24p$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    cberry@cinenet.net (Craig Berry) writes:
:In other words, suppose we posit a subroutine named
:find_undefs_in_string, or fuis() for short.  If I call
:
:  fuis('Hi $person this is $app and your bill is $bill');
:
:what is the return value you want, if (say) $app is defined but the other
:two aren't?

This is unsolvable in the general case.  Lexicals.

--tom
-- 
    "To claim any more than that is to invite a religious war, which I ain't.
    Go thou and don't likewise."
    	--Larry Wall


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

Date: 29 Jun 1998 17:46:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to check variables exists in a string
Message-Id: <6n8jtb$1d9$2@marina.cinenet.net>

Tom Christiansen (tchrist@mox.perl.com) wrote:
:  [courtesy cc of this posting sent to cited author via email]
: 
: In comp.lang.perl.misc, 
:     cberry@cinenet.net (Craig Berry) writes:
: :In other words, suppose we posit a subroutine named
: :find_undefs_in_string, or fuis() for short.  If I call
: :
: :  fuis('Hi $person this is $app and your bill is $bill');
: :
: :what is the return value you want, if (say) $app is defined but the other
: :two aren't?
: 
: This is unsolvable in the general case.  Lexicals.

Good catch.  Add the specification that only global vars will be testable.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Mon, 29 Jun 1998 23:30:37 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: How to check variables exists in a string
Message-Id: <1dbepu1.1ix3q501njkwdoN@bay2-15.quincy.ziplink.net>

Tony Edwardson <edwarton@ml.com> wrote:

> One problem with this solution is that I' can no longer 'use strict'
> because if the variable to be expanded is declared with 'my'
> then $$varname doesn't find it

Symbolic references resolve to symbol table entries.  Lexical variables
(variables declared with my) are not in the symbol table.

> Any ideas how I can get this to work with 'use strict' ?

Instead of my, declare your variables with the vars pragma:
use vars qw($scalar @array ...);

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Mon, 29 Jun 1998 23:30:32 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: How to check variables exists in a string
Message-Id: <1dbeph1.1txs75e11655z4N@bay2-15.quincy.ziplink.net>

F.Quednau <quednauf@nortel.co.uk> wrote:

> while (m/([\$%@]\w+)\b/g) {

$2e3 is not a valid variable name.

Assuming you don't want $0 or the $1, $2, etc. variables:

m/([$%@][a-zA-Z_][a-zA-Z0-9_]*)/g

Locale independent too.  I don't think accented letters are allowed in
variables names.  :-)

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Tue, 30 Jun 1998 11:58:29 +0100
From: Tony Edwardson <edwarton@ml.com>
To: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: How to check variables exists in a string
Message-Id: <3598C4D5.7ECC22E6@ml.com>


--------------C98D431452B757B155EA9F7A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi Frank

The
my $curr_pos = pos $_; # Get the current position in the string
pos $_ = $curr_pos; # Move the match on to the current position
bits were to get and set the current position onn the string so you don't keep matching
the same variable on each iteration.

However I now find that this is superfluous and should be omitted.

Tony

F.Quednau wrote:

> Tony Edwardson wrote:
> >
> > The problem is your use of the /g modifier to a regular expression match.
> >
> > Your 'if' statement will only return true once and so will only increment $c once -
> > hence you get 1 returned.
>
> > $c = 0;
> > $_ = '$hello, %var, @array, $another$together%andmore.@hello';
> >
> > while (m/([\$%@]\w+)\b/g) {
> >  $c++;
> >  my $curr_pos = pos $_; # Get the current position in the string
> >  pos $_ = $curr_pos; # Move the match on to the current position
> > }
> >
>
> Excellent. Thanks. However, you've just opened yourself to a question tirade :)
>
> This script now works:
>
> $c = 0;
> $_ = '$hello, %var, @array, $another$together%andmore.@hello';
>
> while (m/([\$%@]\w+)\b/g) {
>  $c++;
>  push @vars, $1;
> }
> print "$c matches\n";
> for (@vars) {print "$_\n";}
>
> - - - -
>
> >  my $curr_pos = pos $_; # Get the current position in the string
> >  pos $_ = $curr_pos; # Move the match on to the current position
>
> What is the point of those expressions? I took them out, because they didn't
> make much sense too me, and they don't seem to affect anything.
>
> And what exactly is actually a word boundary? Ah, sorry, it is in the perlre
> page:
>
> ...defined as a spot between two characters that has a \w on one side of it and
> and a \W on the other side of it (in either
> order), counting the imaginary characters off the beginning and end of the
> string as matching a \W...
>
> Cheers.
>
> --
> ____________________________________________________________
> Frank Quednau
> http://www.surrey.ac.uk/~me51fq
> ________________________________________________



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

<HTML>
Hi Frank

<P>The
<BR><FONT COLOR="#3333FF">my $curr_pos = pos $_; # Get the current position
in the string</FONT>
<BR><FONT COLOR="#3333FF">pos $_ = $curr_pos; # Move the match on to the
current position</FONT>
<BR><FONT COLOR="#000000">bits were to get and set the current position
onn the string so you don't keep matching the same variable on each iteration.</FONT><FONT COLOR="#000000"></FONT>

<P><FONT COLOR="#000000">However I now find that this is superfluous and
should be omitted.</FONT><FONT COLOR="#000000"></FONT>

<P><FONT COLOR="#000000">Tony</FONT>

<P>F.Quednau wrote:
<BLOCKQUOTE TYPE=CITE>Tony Edwardson wrote:
<BR>>
<BR>> The problem is your use of the /g modifier to a regular expression
match.
<BR>>
<BR>> Your 'if' statement will only return true once and so will only increment
$c once -
<BR>> hence you get 1 returned.

<P>> $c = 0;
<BR>> $_ = '$hello, %var, @array, $another$together%andmore.@hello';
<BR>>
<BR>> while (m/([\$%@]\w+)\b/g) {
<BR>>&nbsp; $c++;
<BR>>&nbsp; my $curr_pos = pos $_; # Get the current position in the string
<BR>>&nbsp; pos $_ = $curr_pos; # Move the match on to the current position
<BR>> }
<BR>>

<P>Excellent. Thanks. However, you've just opened yourself to a question
tirade :)

<P>This script now works:

<P>$c = 0;
<BR>$_ = '$hello, %var, @array, $another$together%andmore.@hello';

<P>while (m/([\$%@]\w+)\b/g) {
<BR>&nbsp;$c++;
<BR>&nbsp;push @vars, $1;
<BR>}
<BR>print "$c matches\n";
<BR>for (@vars) {print "$_\n";}

<P>- - - -

<P>>&nbsp; my $curr_pos = pos $_; # Get the current position in the string
<BR>>&nbsp; pos $_ = $curr_pos; # Move the match on to the current position

<P>What is the point of those expressions? I took them out, because they
didn't
<BR>make much sense too me, and they don't seem to affect anything.

<P>And what exactly is actually a word boundary? Ah, sorry, it is in the
perlre
<BR>page:

<P>...defined as a spot between two characters that has a \w on one side
of it and
<BR>and a \W on the other side of it (in either
<BR>order), counting the imaginary characters off the beginning and end
of the
<BR>string as matching a \W...

<P>Cheers.

<P>--
<BR>____________________________________________________________
<BR>Frank Quednau
<BR><A HREF="http://www.surrey.ac.uk/~me51fq">http://www.surrey.ac.uk/~me51fq</A>
<BR>________________________________________________</BLOCKQUOTE>
&nbsp;</HTML>

--------------C98D431452B757B155EA9F7A--



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

Date: Mon, 29 Jun 1998 23:41:36 +0300
From: Delian Delchev <delian@ntrl.net>
Subject: how to flush network connections
Message-Id: <3597FC00.BE123BEF@ntrl.net>

I write a perl script that makes tcp connection to port 25. I need to
flush all data that is in stream queue, because mail server not respont,
and then timeout and close connection. How I can flush file descriptor?

--
Delian Delchev           http://www.naturella.com/~delian
    ____    ____   __      ____   _     _  ____   __   __
   /    )  /    )  /      /    )  /    /  /    )  /    /
  /    /  /___    /      /       /___ /  /___    /    /
 /    /  /       /      /       /    /  /       /    /
/____/  (____/  /____) (____/ _/    /_ (____/   \___/




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

Date: Mon, 29 Jun 1998 10:30:45 -0400
From: "LAMARTINIERE, ALAIN" <alain.lamartiniere@bellsygma.com>
Subject: How to give input to HSQL command
Message-Id: <3597A515.F0478A74@bellsygma.com>


--------------41AA2D21A751EEDDD3C29F09
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

I am using Perl.dll in IIS to execute Perl script writed for Unix
platform.
I would like to use them with IIS but I have some difficults to execute
the following command:

open ( SQL, "hsql -nh -s -usr '$FORM{UserName}' -pw '$FORM{Password}'
2>&1 <<-!!!
           SELECT RealName FROM HarUser WHERE UserName='$FORM{UserName}'

!!!
  |");

The error message I receive is:
                   "<< was unexpected at this time."

This script was writed to execute CCC/Harvest commands and works fine in
Unix environment, But it seems
that with IIS the input for the command is not well formatted.

Does somebody can help me or give me some indication.
Thanks in advance

  A. Lamartiniere ( alain.lamartiniere@bellsygma.com )
--
=====================================================================
 Alain Lamartiniere                Tel. (514) 786-2020
 Consultant                        Fax. (514) 870-3004
 Bell sygma Telecom Solutions
 700 de la Gauchetiere, 25E1       Email:
 Montreal, Quebec, H3B 4L1          alain.lamartiniere@bellsygma.com
=====================================================================


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

<HTML>
Hi,

<P>I am using Perl.dll in IIS to execute Perl script writed for Unix platform.
<BR>I would like to use them with IIS but I have some difficults to execute
the following command:

<P><I>open ( SQL, "hsql -nh -s -usr '$FORM{UserName}' -pw '$FORM{Password}'
2>&amp;1 &lt;&lt;-!!!</I>
<BR><I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT
RealName FROM HarUser WHERE UserName='$FORM{UserName}'</I>
<BR><I>!!!</I>
<BR><I>&nbsp; |");</I>

<P>The error message I receive is:
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"&lt;&lt; was unexpected at this time."

<P>This script was writed to execute CCC/Harvest commands and works fine
in Unix environment, But it seems
<BR>that with IIS the input for the command is not well formatted.

<P>Does somebody can help me or give me some indication.
<BR>Thanks in advance

<P>&nbsp; A. Lamartiniere ( alain.lamartiniere@bellsygma.com )
<BR>--
<BR>=====================================================================
<BR>&nbsp;Alain Lamartiniere&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Tel. (514) 786-2020
<BR>&nbsp;Consultant&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Fax. (514) 870-3004
<BR>&nbsp;Bell sygma Telecom Solutions
<BR>&nbsp;700 de la Gauchetiere, 25E1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Email:
<BR>&nbsp;Montreal, Quebec, H3B 4L1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
alain.lamartiniere@bellsygma.com
<BR>=====================================================================
<BR>&nbsp;</HTML>

--------------41AA2D21A751EEDDD3C29F09--



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

Date: Mon, 29 Jun 1998 16:30:36 GMT
From: David Corcoran <david.x.corcoran@boeing.com>
To: "LAMARTINIERE, ALAIN" <alain.lamartiniere@bellsygma.com>
Subject: Re: How to give input to HSQL command
Message-Id: <3597C12C.3452@boeing.com>

LAMARTINIERE, ALAIN wrote:

> I would like to use them with IIS but I have some difficults to
> execute the following command:
> 
> open ( SQL, "hsql -nh -s -usr '$FORM{UserName}' -pw '$FORM{Password}'
> 2>&1 <<-!!!
>            SELECT RealName FROM HarUser WHERE
> UserName='$FORM{UserName}'
> !!!
>   |");
> 
> The error message I receive is:
>                    "<< was unexpected at this time."
> 
> This script was writed to execute CCC/Harvest commands and works fine
> in Unix environment, But it seems
> that with IIS the input for the command is not well formatted.

You forget the NT shell is a toy: it doesn't understand the "here doc"
construct.


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

Date: 28 Jun 1998 21:36:07 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: how to know the limit of a perl array?
Message-Id: <6n6r27$9ai$1@monet.op.net>


In article <6n0qhc$f7j@myst.plaza.ds.adp.com>,
Yongyan Wang <ywang@emma.plaza.ds.adp.com> wrote:
>How can I know the limit of the subscript of the variable?
>Practically, can I do the following
>$var[1000000000000000000000000]="value"; ?

Yes, if

1. Your computer can handle an integer that large

and

2. Your computer has enough memory to store such a large array.

(2) is unlikely.  I notice that 1000000000000000000000000 is too big
to fit in a 64-bit integer number, so (1) is also unlikely.

The largest signed 32-bit integer is 2147483647; this is probably the
upper bound of an array on your computer. If you need a bigger array,
Perl can probably do it, but you will have to get a better computer.



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

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

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