[8171] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1788 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 2 13:11:49 1998

Date: Mon, 2 Feb 98 10:00:30 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 2 Feb 1998     Volume: 8 Number: 1788

Today's topics:
    Re: boston.pm.org (Chris Nandor)
        crypt in perl CGI <francken@kbinirsnb.be>
    Re: Decent Perl books (Tad McClellan)
    Re: Deleting directories (Jonathan Nicholson)
    Re: Freidl's book mystery (Chip Salzenberg)
    Re: How to set return code for warnings and errors: may <jdporter@min.net>
    Re: How to write fixed format data? (Tad McClellan)
    Re: How to write fixed format data? <barnett@houston.Geco-Prakla.slb.com>
    Re: html tags <ebohlman@netcom.com>
        I Got A Bug in My Program! (Philip Hood)
    Re: Looking Vor Binary Compiler <ebohlman@netcom.com>
        mkdir and mkdir -p (Michael Wang)
    Re: mkdir and mkdir -p <ebohlman@netcom.com>
        NAWK to PERL conversion rclift@riscman.com
    Re: newbie Q:create a subset (Mike Stok)
    Re: newbie Q:create a subset <merlyn@stonehenge.com>
    Re: newbie Q:create a subset <ebohlman@netcom.com>
    Re: newbie Q:create a subset (Andrew M. Langmead)
    Re: Passing URL to Browser from Script (Honza Pazdziora)
    Re: perl and dde in windows NT scott@softbase.com
        perl and file system <fabrice.gonton@aigf.sncf.fr>
        Perl/Msql problem rreuss@nmdp.org
    Re: Perl5 Database (Bruce Davidson)
    Re: solution for multiline comments??? <barnett@houston.Geco-Prakla.slb.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 02 Feb 1998 12:39:38 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: boston.pm.org
Message-Id: <pudge-0202981239390001@ppp-4.ts-1.kin.idt.net>

In article <vx990rupnuf.fsf@panix.com>, David Adler <dha@panix.com> wrote:

# pudge@pobox.com (Chris Nandor) writes:
# 
# > sub hockey {
# >   return "the Boston Bruins beat up on the NY Rangers yesterday :)"
# > }
# 
# Hmm... methinks the ny.pm module may just have to add C<sub
# bite_me>. :-)

Well, the Isles did manage a tie against the Bruins yesterday, so that is
something.

Should I add:

sub hoops {
   return 'The Celtics beat the Knicks this month for the ' .
          'first time in a decade'  # :)
}

# But seriously folks, best wishes on boston.pm!

Thanks much.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==       New Book: MacPerl:  Programming for the Rest of Us       ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


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

Date: Mon, 2 Feb 1998 17:25:19 +0100
From: "Frederic Francken" <francken@kbinirsnb.be>
Subject: crypt in perl CGI
Message-Id: <6b4rv4$i69$1@dalet.belnet.be>

Can anyone help me with writing a small script which generates a =
password file using the crypt routine as htpasswd does?
I'm not at all familiar with Perl, so help is much appreciated.
The script should ask a filename (password file) and a userID after =
which it asks for a password twice.
The file structure should be something like this :
# UserID : Password
admin:A.f0Kvdiyy8q2
author:zs047RckAhJH6
guest:ZX9XTlIfPvdGE
jack:LQMzROtI8dcTQ
jill:qzWZ6oWmje.kw
jane:KXb4hMvztni/c
laura:JebVuPejyi3Xw
bob:pBYx.CMPzt3ss

Thanks a lot in advance, because I'm really stuck here ...



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

Date: Mon, 2 Feb 1998 06:12:48 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Decent Perl books
Message-Id: <08d4b6.np6.ln@localhost>

Chris Heiden (cmheiden@mtu.edu) wrote:
: Hello there,
:     I am new to the Perl community.  I was wondering if any of you could
: recommend any books as tutorials and reference to Perl.  I already have
: two from Learning Perl and Learning Perl on Win32 systems from O'reilly
: and Associates.  I just wanted to see what everyone out there with
: actual experience with some books had to say.


Perl FAQ, part 2 has a section titled "Perl Books":

------------------------
A number books on Perl and/or CGI programming are available.  A few of
these are good, some are ok, but many aren't worth your money.  Tom
Christiansen maintains a list of these books, some with extensive
reviews, at http://www.perl.com/perl/critiques/index.html.

 ... (much more snipped. See the actual FAQ)
------------------------



--
    Tad McClellan           BSEE, 1985
    tadmc@metronet.com      Michigan Technological University
    Fort Worth, Texas       
                            I remember not seeing the tops of snowbanks
                               for months at a time.
                            (because they were above eye level)

                            Don't seem to have that problem anymore ;-)


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

Date: 2 Feb 1998 17:43:38 -0000
From: jono@nospam.nowhere.noorg (Jonathan Nicholson)
Subject: Re: Deleting directories
Message-Id: <6b50ka$hfk$1@acme.demon.co.uk>

In article <34D50E06.D8A1E43D@ici.net>, David Wagner  <davew@ici.net> wrote:
>I'm trying to delete a directory that has files in it. I have
>"Programming Perl", "Learning Perl", "CGI Programming with Perl", and
>"Perl for Dummies". Each one has a short statement that simply says Perl
>will only delete directories without any files in them. Is there a way?
>Or, how can I delete files within a known directory without knowing the
>file names. The names will be generated later by users.

Here's the little subroutine I use to do just that:-

sub recursiverm {
        my $file;
        my ($directory) =  @_;
	if (! -d $directory  )
	{
		unlink $directory;
		return;
	}
        opendir THISDIR, $directory or return;
        foreach $file ( grep !/^\.\.?$/, readdir THISDIR ) {
                &recursiverm("$directory/$file");
        }
        closedir THISDIR;
        rmdir $directory;
}

Its bloody fast too, on Digital Unix it will out perform the system rm -rf

Regards,

Jonathan

-- 
| Jonathan Nicholson (jono at acme dot demon dot co dot uk)  0973 199 983   |
|            TV doesn't rule my life, it just has a casting vote            |


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

Date: Fri, 30 Jan 1998 04:43:54 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Freidl's book mystery
Message-Id: <6arltv$9of$1@cyprus.atlantic.net>

According to ilya@math.ohio-state.edu (Ilya Zakharevich):
>Chip writes:
>> Well, yes, I have committed the sin of not including benchmarks.
>> However, given all the malloc'ing and freeing that Perl does, it
>> stretches my credulity to believe that _one_ malloc/free, of the
>> size of the match (not the size of the target), can be that much
>> of a factor in performance.
>
>You do not need to believe anything.  The guy who found this 10000x
>slow-down in a real application created a short demo which showed 100x
>slowdown.  This demo was sent to you ...

I recall that.  The fact that something is slow doesn't prove that
the reason you give is the cause.  You will, given the personalities
involved, perhaps forgive me for being skeptical about your analysis.

> ... found the reason in your faulty patch.

I contest the word "faulty".  The patch fixed access of freed memory.
In no way can fix be considered a bad thing -- not by those who
properly value reliability, anyway -- because without the fix, Perl's
behavior was not always correct.  "If you don't care about getting the
right answer, I can get it as fast as you want."

*HOWEVER*, on a different issue, I must say -- in the words of Wrong
Way Corrigan -- "Oops."  Ilya is entirely correct in this observation:

>P.S.  Of course the malloc *is* the size of the target (not the size
>of the match), otherwise $', $` would not work.

Mea culpa for not grasping this truth at first reading of the code.

It is of course entirely possible to optimize the string saving to
be only the matched string when "sawampersand" is false.  In fact,
there is some reason here to distinguish between $& and $`/$', since
the former does not force whole-string saving, but the latter does.

I *hope* to get a patch for this in 5.004_05.  (No promises.)
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org
           ->  Ask me about Perl training and consulting  <-
             "It's the lemon zester of death!!"   // MST3K


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

Date: Mon, 02 Feb 1998 12:11:48 -0500
From: John Porter <jdporter@min.net>
Subject: Re: How to set return code for warnings and errors: maybe $rc |= n; ?
Message-Id: <34D5FE54.3E25@min.net>

Steven Tolkin wrote:
> 
>     $rc = 1 if $rc < 1;  # I type this line a lot
>
> To save typing I am tempted to replace the first commented line above
> with
> $rc |= 1;
>
> Another approach would be something like: $rc = max($rc,1);
> What I really want is an operator max= analagous to |= so I could code:
> $rc max= 1;
> (This thinking is how I arrived at trying |=.  This approach can be

I can tell you right now, $rc |= 1; is NOT the same as 
 $rc = 1 if $rc < 1, nor as $rc = max($rc,1).
|= does a BITWISE or. Which means that if $rc is 2, then you get
3, which is obviously not what you want.  Use ||=.

OTOH, maybe you would like to use the two low-order bits as flags,
with 0x01=Warning and 0x02=Error.  E.g.
  $rc = 0;
  whenever ( warning condition ) { $rc |= 1; }
  whenever (  error  condition ) { $rc |= 2; }
  exit $rc;
So that
  0 = AOK
  1 = warning(s)
  2 = error(s)
  3 = error(s) and warning(s)

hth,
John Porter


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

Date: Mon, 2 Feb 1998 05:32:15 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How to write fixed format data?
Message-Id: <vra4b6.1k6.ln@localhost>

Jaime Metcher (metcher@spider.herston.uq.edu.au) wrote:
: Printf pops up again and again in the perl docs (must be a useful
: routine). However, Win32 users don't necessarily have documentation for
: printf formats.   There's nothing in the perl docs or the FAQs. 
                            ^^^^^^^^^^^^^^^^^^^^^^^^

There is in _my_ perl docs...


: I'd say that references in the perl docs and the camel to documentation
: that is non-existent on something like 50% of perl installations does
: nothing to enhance cross-platform appeal.


Since you seem documentation impoverished ;-) I'll share mine
with you.


>From 'perlfunc' (perl v5.004):
-------------------------------------------------------

=item sprintf FORMAT, LIST

Returns a string formatted by the usual printf conventions of the
C library function sprintf().  See L<sprintf(3)> or L<printf(3)>
on your system for an explanation of the general principles.

Perl does all of its own sprintf() formatting -- it emulates the C
function sprintf(), but it doesn't use it (except for floating-point
numbers, and even then only the standard modifiers are allowed).  As a
result, any non-standard extensions in your local sprintf() are not
available from Perl.

Perl's sprintf() permits the following universally-known conversions:

   %%   a percent sign
   %c   a character with the given number
   %s   a string
   %d   a signed integer, in decimal
   %u   an unsigned integer, in decimal
   %o   an unsigned integer, in octal
   %x   an unsigned integer, in hexadecimal
   %e   a floating-point number, in scientific notation
   %f   a floating-point number, in fixed decimal notation
   %g   a floating-point number, in %e or %f notation

In addition, Perl permits the following widely-supported conversions:

   %X   like %x, but using upper-case letters
   %E   like %e, but using an upper-case "E"
   %G   like %g, but with an upper-case "E" (if applicable)
   %p   a pointer (outputs the Perl value's address in hexadecimal)
   %n   special: *stores* the number of characters output so far
        into the next variable in the parameter list

Finally, for backward (and we do mean "backward") compatibility, Perl
permits these unnecessary but widely-supported conversions:

   %i   a synonym for %d
   %D   a synonym for %ld
   %U   a synonym for %lu
   %O   a synonym for %lo
   %F   a synonym for %f
Perl permits the following universally-known flags between the C<%>
and the conversion letter:

   space   prefix positive number with a space
   +       prefix positive number with a plus sign
   -       left-justify within the field
   0       use zeros, not spaces, to right-justify
   #       prefix octal with "0", hex with "0x"
   number  minimum field width
   .number "precision": digits after decimal point for floating-point,
           max length for string, minimum length for integer
   l       interpret integer as C type "long" or "unsigned long"
   h       interpret integer as C type "short" or "unsigned short"

There is also one Perl-specific flag:

   V       interpret integer as Perl's standard integer type

Where a number would appear in the flags, an asterisk ("*") may be
used instead, in which case Perl uses the next item in the parameter
list as the given number (that is, as the field width or precision).
If a field width obtained through "*" is negative, it has the same
effect as the '-' flag: left-justification.

If C<use locale> is in effect, the character used for the decimal
point in formatted real numbers is affected by the LC_NUMERIC locale.
See L<perllocale>.



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


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

Date: Mon, 02 Feb 1998 10:30:18 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: How to write fixed format data?
Message-Id: <34D5F49A.BCAC42B5@houston.Geco-Prakla.slb.com>

Jaime Metcher wrote:
<snip>
> Jaime Metcher
>
(apologies to Jaime....don't have original post, so snipped his reply)
 
> Tad McClellan wrote:
> >
> > Pascal Houde (houde@fox.cisti.nrc.ca) wrote:
> > : I'm currently using the format function to set a fixed record.
> > : So it looks like:
> > : format my_record =
> > : @<<<<<<@<<@<<<< etc...
> > : $field1,$field2,$field3,  etc...
> >
> > : The problem is that my fixed record is over 1000 chars long!
> > : Some fields are 200 long. So you imagine the number of <<< I have!
> > : Is there any other way to set a fixed record in a simpler way?
> >
> > printf() instead of format maybe?
> >
pack() is also very effective.....Can do space padding using "A" (note
this is a capital letter A).
pack(A4A5A9, $a, $b, $c);

would genereate a 4, 5, and 9 character field.  See below:
#!/usr/local/bin/perl -w
#
$a = "1";
$b = "21";
$c = "388588";
print "<", pack ("A4A5A9", $a, $b, $c), ">\n";
print "12345678901234567890123456789012345678901234567890\n";
__END__

Prints out:
<1   21   388588   >
12345678901234567890123456789012345678901234567890

You can also write the pack line as follows:
#!/usr/local/bin/perl -w
#
$a = "1";
$b = "21";
$c = "388588";
print "<", pack ("A4
A5
A9",
$a,
$b,
$c), ">\n";
print "12345678901234567890123456789012345678901234567890\n";
__END__

That is doable, but is harder to read and follow, IMO, and that's only
with 3 formats, and 3 values....

HTH.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: Mon, 2 Feb 1998 16:36:49 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: html tags
Message-Id: <ebohlmanEnrFHE.F88@netcom.com>

Jason Boxman <benefits@cybertechs.com> wrote:
: I have a script which strips all text in between HTML tags except
: spaces. I use following code, which causes an exception error on some
: files.

: $tester =~ s/(>)(\s)?([^<])*?(\s)?(<)/\1\2\4\5/g;

: Is there a better way to preserve the HTML tags and at least one space
: in between each tag (if there are any) that will not cause an exception
: error on occasion? I appreciate any help you can give me, thanks!

Seriously, the best way to do this is to use HTML::Parse, available at 
finer CPAN sites near you.  You also should check out the discussion of 
"how do I remove HTML from a string" (which translates to your 
requirement if you simply flip what gets kept and what gets dropped) in 
perlfaq9.pod.

You've got a couple problems with your regex and your substitution, 
though.  Let's use the /x modifier so we can format your regex for 
commentary:

: $tester =~ s/
   (>)
#this matches a single right angle-bracket and stores it in $1
#(but why bother storing it if you always know what it will be?)

   (\s)?
#this matches zero or one whitespaces, and stores it in $2.

   ([^<])*?
#this matches zero or more occurrences of anything other than a left 
#angle-bracket, and stores it in $3.  Note that the matching stops as
#soon as anything that matches the rest of the expression is found.

   (\s)?
#this matches zero or one whitespaces and stores it in $4.

   (<)
#this matches a single left angle-bracket and stores it in $5.

   /\1\2\4\5/gx;

This usage of \n is deprecated; they should be replaced with $n.  \n 
should be used only in the regex, not in the substitution pattern.
It could be rewritten as:

/>$2$4</gx;

The most obvious problem here is that if the text outside the tags 
contains, inside quotes, a whitespace character followed by a <, your 
code will see the < as the start of a tag and everything will get badly 
out of sync.  HTML::Parse knows about quoting and keeping track of paired 
quotes, which is impossible for a pure regex to do.

HTML::Parse also understands the fact that a < followed by anything other 
that a letter or a slash does not represent the beginning of a tag, and 
that </ followed by anything other than a letter or a > doesn't represent 
the beginning of an end-tag.

I don't, though, see what could be causing an error message, and it would 
be helpful if you'd tell us exactly what the error message says.



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

Date: 2 Feb 1998 12:11:33 -0500
From: hood@panix.com (Philip Hood)
Subject: I Got A Bug in My Program!
Message-Id: <6b4uo5$l8s@panix.com>

Hello, All ...

I usually lurk on this channel, but lately want to
get more involved & see that the only way for me to
do is to get involved.

A while ago, I wrote a Shopping Cart Script, which
I hoped would make me some money, but I don't think
it was marketed correct, and anyway, it's for the 
best, because there are some errors in it that I
been too stranged out to fix since returning from 
China.

I was wondering if anyone would like to look over the
site, and play w/ the script & even try to break it
& maybe have some suggestions for me on how I should
fix the code/make it better ... security problems &
other suchness. 

http://www.omtp.com/imagine

More later ...
PH
 




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

Date: Mon, 2 Feb 1998 16:41:00 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Looking Vor Binary Compiler
Message-Id: <ebohlmanEnrFoD.FKv@netcom.com>

Eddie Gonzalez <egonzalez@rpimail.mdacc.tmc.edu> wrote:
: I am about to install Perl and need a compiler.  I need a binary
: compiler to download
: for free because there is no current compiler for the server.  Thanks...

How do you expect anyone to tell you where to find a binary for your 
platform if you don't tell them what platform it is?  Binaries aren't 
interchangeable between platforms, ya know?



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

Date: 2 Feb 1998 15:46:33 GMT
From: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: mkdir and mkdir -p
Message-Id: <6b4pop$85g$1@news.ml.com>

Though perl provides "mkdir" but it can not do "mkdir -p",
for that I have to do system ("mkdir -p ..."); is there
a better solution? Thanks. 


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

Date: Mon, 2 Feb 1998 16:53:50 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: mkdir and mkdir -p
Message-Id: <ebohlmanEnrG9q.GG6@netcom.com>

Michael Wang <mwang@alhena.ibk.ml.com> wrote:
: Though perl provides "mkdir" but it can not do "mkdir -p",
: for that I have to do system ("mkdir -p ..."); is there
: a better solution? Thanks. 

Yep.  Use File::Path, which should have come with your standard distribution.



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

Date: Mon, 02 Feb 1998 16:07:13 GMT
From: rclift@riscman.com
Subject: NAWK to PERL conversion
Message-Id: <34d5ef14.6796683@news.packet.net>

I have a nawk script that I am trying to convert to perl.  The script
searches for the string "Name =" in the source file and if it finds
it, replaces all spaces between " " with underbars.  For example, the
original string:

Name = "text1 text2 text3"

Would be changed to:

Name = "text1_text2_text3"

I used the following script to do this with nawk:

nawk '
    {
     field = $1
     string = "Name"
     if (field == string) {
        if ($NF > 3) {
          gsub(/\ /, "_", $0)
          gsub(/\_\=\_/, " = ", $0)
          sub(/\_*\_/, "         ", $0) 
          print $0 > "temp.mif" 
        }
        else print $0 > "temp.mif"
     }
     else print $0 > "temp.mif"
}' $SOURCE_MIF


Does anyone know how to do this in perl??  If so, please email
rclift@riscman.com as I do not check the usenet posting very often.

Thanks......

Rick Clift



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

Date: 2 Feb 1998 11:20:13 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: newbie Q:create a subset
Message-Id: <6b4rnt$uf$1@stok.co.uk>

In article <34D5E7C5.74D9F20E@ms.com>, Raghu Hon  <honr@ms.com> wrote:
>hi! 
>If I have Arrays  @A and @B
>How do I create an subset(or delta array)  @C, 
>where in @C should contain elements which are 
>in @A but Not in @B.
>thanks,

You can do something like this verbose snippet:

#!/usr/local/bin/perl -w

@A = ('Adrian', 'Bill', 'Robert', 'Tony', 'Pat', 'Trey');
@B = ('Adrian', 'Bill', 'Robert', 'Tony');

{
  local (%mark);

  @mark{@B} = (1) x @B;

  @C = ();

  for (@A) {
    push @C, $_ unless $mark{$_};
  }
}

print "C is @C\n";

__END__

or you can use perl 5's map to make it shorter, the block can be:

{
  my (%mark) = map {$_ => 1} @B;
  @C = map {$mark{$_} ? () : $_} @A;
}

or you can look in the FAQ which suggests this in section 4:

How do I compute the difference of two arrays? How do I compute the
intersection of two arrays?

Use a hash. Here's code to do both and more. It assumes that each element
is unique in a given array: 

    @union = @intersection = @difference = ();
    %count = ();
    foreach $element (@array1, @array2) { $count{$element}++ }
    foreach $element (keys %count) {
        push @union, $element;
        push @{ $count{$element} > 1 ? \@intersection : \@difference }, $element;
    }

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 02 Feb 1998 09:28:55 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Raghu Hon <honr@ms.com>
Subject: Re: newbie Q:create a subset
Message-Id: <8cvhuyq8c8.fsf@gadget.cscaper.com>

>>>>> "Raghu" == Raghu Hon <honr@ms.com> writes:

Raghu> If I have Arrays  @A and @B
Raghu> How do I create an subset(or delta array)  @C, 
Raghu> where in @C should contain elements which are 
Raghu> in @A but Not in @B.

Here's my current favorite for that.  Beware that the
delete-hash-slice operator doesn't work prior to 5.004.  (Good reason
to upgrade, and it's FREE! :-)

    { my %foo; @foo{@A} = (); delete @foo{@B}; @C = keys %foo; }

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 210 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Mon, 2 Feb 1998 16:45:12 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: newbie Q:create a subset
Message-Id: <ebohlmanEnrFvD.Fwp@netcom.com>

Raghu Hon <honr@ms.com> wrote:
: hi! 
: If I have Arrays  @A and @B
: How do I create an subset(or delta array)  @C, 
: where in @C should contain elements which are 
: in @A but Not in @B.

In perlfaq4.pod, you'll find an entry entitled "how do I compute the 
difference of two arrays."

Note that this can become very complicated if the arrays contain 
references; you might want to do a DejaNews search on this group to find 
a discussion that occurred a couple weeks ago regarding how to determine 
if two arrays are identical.



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

Date: Mon, 2 Feb 1998 17:20:22 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: newbie Q:create a subset
Message-Id: <EnrHHy.4Bv@world.std.com>

Raghu Hon <honr@ms.com> writes:

>If I have Arrays  @A and @B
>How do I create an subset(or delta array)  @C, 
>where in @C should contain elements which are 
>in @A but Not in @B.
>thanks,
>-Raj
>-----------------------------------------------

>I was trying this , but does not seem to work.
>any hints please. thanks

>%old = @old = @B;
>%deltaD = @deltaD = ();

I don't think these two lines are doing what you think that they are
doing. When you assign "%old = @old", you are not creating keys in the
hash for each element of @old. You are mapping pairs of elements of
@old to key,value pairs.

Have you seen the entry in the FAQ titled "How do I compute the
difference of two arrays?  How do I compute the intersection of two
arrays?" Its not exactly what you want, (the difference between two
arrays show what appears exactly once in @A and @B. Your requirements
imply not getting elements that only appear in @B.) but it might put
you on the right track.

@A = 'a' .. 'z';
@B = split //, 'aml@world.std.com';

for $elem (@B) {
  $seen{$elem} = 1;
}
# or less readably as @seen{@B} = (1) x @B;

@C = grep { not $seen{$_} } @A;

print "@C\n";
-- 
Andrew Langmead


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

Date: Mon, 2 Feb 1998 17:03:47 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Passing URL to Browser from Script
Message-Id: <adelton.886439027@aisa.fi.muni.cz>

Scott Kelley <jsk2@axe.humboldt.edu> writes:

> I'm trying to write a CGI script that will pass a URL to the user's
> browser rather than the script printing the file line by line.  Any
> thoughts?

Yes. Where are the Perl ideas that you want us to comment on?

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: 2 Feb 1998 15:22:43 GMT
From: scott@softbase.com
Subject: Re: perl and dde in windows NT
Message-Id: <6b4oc3$nsa$1@mainsrv.main.nc.us>

alison@cs.jcu.edu.au wrote:

> I would like to know if Perl for Win32 can communicate with other
> applications within Windows NT using DDE control stuff.

I have never heard of anyone doing this, no. DDE is an ancient
IPC protocol that has been superceded by ... well, everything.
Try using Automation.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: 02 Feb 1998 16:53:45 +0100
From: Fabrice Gonton <fabrice.gonton@aigf.sncf.fr>
Subject: perl and file system
Message-Id: <ra5muho6.fsf@aigf.sncf.fr>


Hello,

I'm running Perl 5.004_4 under Unix (Solaris 2.5.1 & OSF/1).
I need to create a file in local fs. So I have to check on
which fs I am. I've done that on Solaris with a statvfs syscall,
and it runs well. But, on OSF/1 4.0, statvfs isn't a syscall.
There's only statfs on OSF/1, and SUN annouced statfs syscall
will be removed from its system in future release. 

Is there a simple way to determine the fs ?


					thanks
-- 
Fabrice
All opinions expressed here are mine ...


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

Date: Mon, 02 Feb 1998 10:41:07 -0600
From: rreuss@nmdp.org
Subject: Perl/Msql problem
Message-Id: <886437303.473825281@dejanews.com>

Hi, I hope someone can help.  I am trying to use Msql and Perl together
and after installing and compiling when I try to run a test script here
is the error I am getting.

Can't find loadable object for module Msql in @INC (<paths>) at
<paths>Msql.pm line 99.

so looking at line 99 of Msql.pm the code is
  Bootstrap Msql;

Does anyone know what is wrong?  Is this a configuration issue?  Please
help!!!

Thanks in Advance

BOB

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Mon, 02 Feb 1998 16:09:53 GMT
From: bruce@allied.demon.co.uk (Bruce Davidson)
Subject: Re: Perl5 Database
Message-Id: <886435942.23712.0.nnrp-07.9e982204@news.demon.co.uk>

chad wrote:

>This may be a crazy way of doing it, but what I do is replace the ^M or CR what
>ever you'd like to call them with some symbol like BR or :-: what ever, then
>save it as one line.  then of course when I want to display it I do the reverse.

That sounds good to me - I figured I'd need to substitute a
chararter(s) for break and para, but still thinking how *best* to
write code for that. Would you have a snippet to give me a pointer
please ? Do you know if Explorer sees wrap=physical yet ?
Mail if you prefer.
Bruce



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

Date: Mon, 02 Feb 1998 10:36:14 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: solution for multiline comments???
Message-Id: <34D5F5FE.B87DF4D5@houston.Geco-Prakla.slb.com>

Bjvrn Nilsson wrote:
> 
> Hi all!
> 
> Has anyone figured out how to in a convienient way do mulitline comments
> a la C, Java etc.
> OK, I know that one solution is to write a perl snippet that looks for
> some special tags (e.g. startcomm and endcomm) and than comment
> everything out in between those lines.
> 
> But is there some kind of simpler solution, where I don't have to
> process a script with a script?
> 
> Bjvrn
It's not terribly elegant, but how about a here document:
#!/usr/local/bin/perl -w
#
$junk = "";	# to keep perl from complaining about typos
$junk = <<EOF;
	These are just some random comments.
	They span multiple lines, and don't 
	end until I put EOF on a line by
	itself.
EOF
print "Hello\n";
__END__

Should print out "Hello", without so much as a peep about the here
document.

HTH.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
* Schlumberger Geco-Prakla   (281) 596-1434 (Office Number)            *
* 1325 S. Dairy Ashford      (281) 596-1807 (Fax)                      *
* Houston, TX 77077                                                    *
------------------------------------------------------------------------


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

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

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