[11102] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4702 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 20 19:05:45 1999

Date: Wed, 20 Jan 99 16:00:17 -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           Wed, 20 Jan 1999     Volume: 8 Number: 4702

Today's topics:
        $0 or @ARGV in a one-liner (??) <jn@n2k.com>
    Re: $0 or @ARGV in a one-liner (??) (Martien Verbruggen)
    Re: as400 net.data <GregStewart@worldnet.att.net>
    Re: CHOWN problem (Martien Verbruggen)
    Re: dbmopen vs. tie <jdf@pobox.com>
        debugger question (Michael Limprecht)
    Re: debugger question (Martien Verbruggen)
        glob expansion broken for 5.004_04 cygwin32 <ktung@i2.com>
        Help - simple matching problem. <tharoldson@home.com>
    Re: Help - simple matching problem. (Martien Verbruggen)
        ignore this posting <bsherry@lucent.com>
    Re: newbie - endless loop on simple program. (Larry Rosler)
    Re: Newbie string question,  please help :) <dgris@moiraine.dimensional.com>
    Re: Newbie string question,  please help :) (Larry Rosler)
    Re: Perl Criticism droby@copyright.com
        Perl from the Market viewpoint <charlesjourdan@worldnet.att.net>
    Re: Perl from the Market viewpoint (Martien Verbruggen)
    Re: Perl uses in NT <jerker.haglund@mailbox.swipnet.se>
        Status of Threaded Perl lchang@alum.mit.edu
        Sys::Syslog equivalent for Win32 (Victor A. Cuya)
    Re: which form of dbm to use? <jdf@pobox.com>
    Re: write is trimming trailing blanks? <rrl@mail.com>
    Re: write is trimming trailing blanks? (Martien Verbruggen)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 20 Jan 1999 18:28:12 -0500
From: John Nolan <jn@n2k.com>
Subject: $0 or @ARGV in a one-liner (??)
Message-Id: <36A6668C.7C9B3B5@n2k.com>

Is there any way to access the actual arguments/switches
passed to the perl binary in a one-liner? 

In other words, if I run:

    perl -e 'print "$0 @ARGV";' 

this does not print out

    perl -e 'print "$0 @ARGV";'

But would anything work like that?
Just curious.  :) 
--
###  John Nolan
###  N2K Inc.
###  610-225-3367
###  jnolan n2k com


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

Date: Wed, 20 Jan 1999 23:47:14 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: $0 or @ARGV in a one-liner (??)
Message-Id: <6Wtp2.58$Rq1.4085@nsw.nnrp.telstra.net>

In article <36A6668C.7C9B3B5@n2k.com>,
	John Nolan <jn@n2k.com> writes:
> Is there any way to access the actual arguments/switches
> passed to the perl binary in a one-liner? 
> 
> In other words, if I run:
> 
>     perl -e 'print "$0 @ARGV";' 
> 
> this does not print out
> 
>     perl -e 'print "$0 @ARGV";'
> 
> But would anything work like that?

nope :)

Martien

PS. Are you really asking how to pass switches to a one liner? 

perl -le 'print "@ARGV"' -- -foo

Another question:
	Why is the -e flag passed on in @ARGV?

-- 
Martien Verbruggen                  | 
Interactive Media Division          | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd.       | make a better idiot.
NSW, Australia                      | 


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

Date: 20 Jan 1999 23:48:19 GMT
From: "Greg Stewart" <GregStewart@worldnet.att.net>
Subject: Re: as400 net.data
Message-Id: <785q03$dbc@bgtnsc03.worldnet.att.net>

Net.data environments are service programs, not programs.

Greg Stewart

Richard Robinson wrote in message <36A3FDD8.99565299@ldr.com>...
>
>Then I  edited my DB2WWW.INI file with the following command:
>
>ENVIRONMENT (DTW_PERL) /QSYS.LIB/PERL5.LIB/PERL.PGM (OUT RETURN_CODE)
>





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

Date: Wed, 20 Jan 1999 22:34:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: CHOWN problem
Message-Id: <eSsp2.21$Rq1.2736@nsw.nnrp.telstra.net>

In article <36A655C0.40976399@xsite.net>,
	Andy Biegel <andy@xsite.net> writes:
> I have a group of files in a single directory created by a cgi script
> (1.shtml ... 100.shtml). Since the script creates them, I assume that
> they are set by default to owner "nobody". I understand that I can use
> chown to set the owner to myself, but I am having trouble doing so. I
> have:

Only on systems that allow you to give away ownership of files. Most
systems don't allow that at all. Only root can change ownership there.

>  @delete="*.shtml";

What is this? You are assigning a scalar to an array. Or are you
trying to do a glob match to get a list of files?

# perldoc -f glob
# perldoc perlop
[look for the <> operator]

Instead of a glob, it is probably better to use opendir, readdir and
grep.

# perldoc readdir

>  chown myusername, @delete;

You don't check the return value of the chown

The first argument to chown _must_ be the numerical user id. The
second one the numerical group id. It returns the number of files
changed.

# perldoc -f chown

This entry also gives some good examples on how to do it.

> BTW, this newsgroup is fantastic when it comes to problem solving!

Thanks. That may very well be true, but the documentation is much
quicker, once you learn how to use it. Try using perldoc once in a
while.

All of the answers I gave you above are discussed in the chown entry
in the perlfunc documentation. I only found this out after I typed
most of this, or otherwise I would have simply pointed you there.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | I took an IQ test and the results were
Commercial Dynamics Pty. Ltd.       | negative.
NSW, Australia                      | 


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

Date: 20 Jan 1999 16:06:49 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: bluepuma@mailexcite.com
Subject: Re: dbmopen vs. tie
Message-Id: <m37lui9e5y.fsf@joshua.panix.com>

bluepuma@mailexcite.com writes:

> If I would use the (not as easy to use) tie function, could I get
> rid of the 1024 byte limitation of the value ?

   $ perldoc AnyDBM_File 

will lay out for you the dis/advantages of various uses of tie().

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: 20 Jan 1999 23:07:10 GMT
From: admiral@Eng.Sun.COM (Michael Limprecht)
Subject: debugger question
Message-Id: <785niu$8m2$1@engnews2.Eng.Sun.COM>


Is there a way to get the debugger to show me a variable(s) and it's value
on the command line every time I step forward?

Better yet, show the variable and it's value when it changes.

Right now I just use the "p" when I think a variable might have changed.

 DB<1> p $sAfbBinDir
/import/foo/release/tools


Thanks,


Mick




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

Date: Wed, 20 Jan 1999 23:40:59 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: debugger question
Message-Id: <fQtp2.54$Rq1.4085@nsw.nnrp.telstra.net>

In article <785niu$8m2$1@engnews2.eng.sun.com>,
	admiral@Eng.Sun.COM (Michael Limprecht) writes:
> 
> Is there a way to get the debugger to show me a variable(s) and it's value
> on the command line every time I step forward?

# perldoc perldebug

look at the >> > < and << commands. Maybe you are really interested in
a watchpoint, check ou the W command.

> Better yet, show the variable and it's value when it changes.

There we go. That's a watchpoint.

Martien

PS. I think watchpoints may be new in 5.005, but I am not entirely
sure. Check your documentation.
-- 
Martien Verbruggen                  | 
Interactive Media Division          | This matter is best disposed of from a
Commercial Dynamics Pty. Ltd.       | great height, over water.
NSW, Australia                      | 


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

Date: Wed, 20 Jan 1999 17:43:48 -0600
From: Kerr Tung <ktung@i2.com>
Subject: glob expansion broken for 5.004_04 cygwin32
Message-Id: <36A66A34.BCBB3426@i2.com>

I have the following line works fine under perl 5.002 but broke under
perl 5.004_04 under NT 4.0:
foreach $element (<$vob_ctignore $local_ctignore>) {

Error message seen:

sh: imake: command not found
sh: *.save: command not found
sh: -c: line 4: syntax error near unexpected token `|t'
sh: -c: line 4: `|tr -s '       Got 12
' '\012\012\012\012''

Note that the "imake" and "*.save" are in the the $vob_ctignore and
$local_ctingore strings.

Is there a where to make this version of perl work with the gloab span?

Thanks,
Kerr
PS. Does anyone know where the perl for Win32 FAQ is? All the URL to
this FAQ says: "from Evangelo Prodromou is currently missing. We are
trying to contact the author, but he too is missing." Unsolved mystery!
Isn't that silly?





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

Date: Wed, 20 Jan 1999 14:46:28 -0600
From: Terry Haroldson <tharoldson@home.com>
Subject: Help - simple matching problem.
Message-Id: <36A640A4.A78D2191@home.com>

I'm new -- be gentle.
I don't understand what I'm doing wrong here.  
The code is:

#!usr/bin/perl
while (<>) {
  chomp;
  m/\ACABLE: /gc;
  $CABLE = /\G\w+/;
  print "$CABLE\n";
}

When I run it on this string:
"CABLE: 8(F1)     DAILY FAULT COUNT"

I was hoping to get "8(F1)" into $CABLE, but it doesn't.  When I single
step thru it and stop just after the 4th line (before '$CABLE =') I get
the following:

DB(1) p $'
8(F1)     DAILY FAULT COUNT

which is what I expected.  But when I single step thru the 5th line, I
get:

DB(2) s
DB(2) p $'
: 8(F1)     DAILY FAULT COUNT
DB(3) p $CABLE
1

firstly, I don't understand why $' is showing the ': ' before '8(F1).  I
thought the \G tells it to anchor to the end of the previous match (ie:
after "CABLE: ").  Then I am ending up with '1' in $CABLE (I think maybe
\w+ isn't cvorrect, but I am more stuck on what's happening with $' ??

Any help is appreciated.

Terry.


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

Date: Wed, 20 Jan 1999 23:12:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Help - simple matching problem.
Message-Id: <pptp2.40$Rq1.4085@nsw.nnrp.telstra.net>

In article <36A640A4.A78D2191@home.com>,
	Terry Haroldson <tharoldson@home.com> writes:
> I'm new -- be gentle.
> I don't understand what I'm doing wrong here.  
> The code is:
> 
> #!usr/bin/perl
> while (<>) {
>   chomp;
>   m/\ACABLE: /gc;
>   $CABLE = /\G\w+/;
>   print "$CABLE\n";
> }

> When I run it on this string:
> "CABLE: 8(F1)     DAILY FAULT COUNT"
> 
> I was hoping to get "8(F1)" into $CABLE, but it doesn't.  When I single

\w only matches word characters, which is alphas, numerics and
underscore. Not parentheses.

A pattern match returns (in scalar context) true (1) or false (''),
not the matched stuff. For that, you need to put it in list context,
and you need to use parentheses.

($CABLE) = /^CABLE: ([^\s]+)/;

I use ^ instead of \A, because I'm more used to it. Instead of trying
to capture only word characters, I get everything up to the next
whitespace, which I think is what you want.

Instead of using \G, I just match it all in one go, because I simply
can't see any reason not to. Besides that, it gets rid of the multiple
matches, and the use of the g modifier where it is inappropriate (You
would normally only use it to loop through a string, or to find all
matches).

> firstly, I don't understand why $' is showing the ': ' before '8(F1).  I
> thought the \G tells it to anchor to the end of the previous match (ie:
> after "CABLE: ").  Then I am ending up with '1' in $CABLE (I think maybe
> \w+ isn't cvorrect, but I am more stuck on what's happening with $' ??

\G only works within a pattern that is being matched with the /g
modifier:

# perldoc perlop
[find the /PATTERN/ entry]
             You can intermix m//g matches with m/\G.../g, where
             \G is a zero-width assertion that matches the exact
             position where the previous m//g, if any, left off.
             The \G assertion is not supported without the /g
             modifier; currently, without /g, \G behaves just
             like \A, but that's accidental and may change in the
             future.

The \G in your pattern works just like \A. The \w+ matches everything
from the beginning of the string, up to the first non-word character,
which is ':'.

So, you either change your second match to a /g modified one, which
will break the results you will get back from it, and introduces
unnecessary complexity, or you do it in one go.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd.       | make a better idiot.
NSW, Australia                      | 


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

Date: Wed, 20 Jan 1999 18:06:02 -0600
From: "Bill Sherry" <bsherry@lucent.com>
Subject: ignore this posting
Message-Id: <785nep$em@nntpb.cb.lucent.com>






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

Date: Wed, 20 Jan 1999 13:59:10 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: newbie - endless loop on simple program.
Message-Id: <MPG.110ff1881a1252ef9899ab@nntp.hpl.hp.com>

In article <7854uh$kdt$2@news0-alterdial.uu.net> on 20 Jan 1999 17:49:05 
GMT, Greg Ward <gward@thrak.cnri.reston.va.us> says...
 ...
> In general, never assume that "x == y" will be true for floating point
> numbers.  You just can't compare them for equality.

My favorite analogy is asking if two piles of sand have the same number 
of grains.

>     Use a relative comparison, eg. recode your loop as
> 
>  until ($num > 1.0) {
>    print "$num ";
>    $num += $increment;
>  }

It shouldn't be done that way either, for sensitive applications, 
because any representation error in $increment accumulates.  One wants 
to do as much as possible with integers.  Thus:

   my $recip_increment = 10;
   for my $num (0 .. 10) {
     printf "%.20f\n", $num / $recip_increment;
   }

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


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

Date: 20 Jan 1999 15:52:48 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Newbie string question,  please help :)
Message-Id: <m37luhy2p3.fsf@moiraine.dimensional.com>

mcafee@waits.facilities.med.umich.edu (Sean McAfee) writes:

> In article <785i0u$odp@sjx-ixn6.ix.netcom.com>,
> Ban Spam Now <no_spam@no_spam.com> wrote:
> >Given a string of length 0 to n
> >How do I loop through the string character by character and perform an
> >operation based on the current character?

> I'd do it this way:

> $string = <STDIN>;
> while ($string =~ /(.)/gs) {
>     if ($1 eq "M") {
>         # do something
>     } elsif ($1 eq "E") {
<snip>

That becomes unreadable as soon as you have a different action
for every possible character.  Imagine a chain of 100 or more
if...elsif...elsif, yuck!

Far better is to load up a dispatch table containing input keys
and associated functions.  Like so-

my %dispatch_table = ( a   => \&do_something_with_a,
                       b   => \&do_something_with_b,
                     ...
                       '*' => \&do_something_with_star );

for (split //, $input) {
    if (exists ($dispatch_table{$_}) {
        &{$dispatch_table{$_}}(@args);
        next;
    }
    # if we get here, then we have input that we don't know how
    # to deal with.  this is presumably an error, it can be handled
    # here.

    die "Bad Input: $_";
}

This becomes even more powerful if you use regular expressions
as the keys to your dispatch table.  I have a lot of code that
says stuff like-

my %dispatch_table = (  '^\s*#(.+)$'      => \&capture_comment,
                        '^=([^\s]+)\s*$'  => \&capture_pod,);


for (keys %dispatch_table) {
    if ($input =~ /$_/) {
        &{$dispatch_table{$_}}(@args);
        last;
    }
}

This could probably be better accomplished today using qr// and
deeper data structures, but that just an optimization of what is
a very powerful technique.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Wed, 20 Jan 1999 15:47:53 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie string question,  please help :)
Message-Id: <MPG.11100b06fcf3d5e89899ac@nntp.hpl.hp.com>

In article <785its$8gb$1@mendelevium.btinternet.com> on Wed, 20 Jan 1999 
21:50:25 -0000, Denny John <denny.john@btinternet.com> says...
> try substring

You mean substr.

> ie something like
> 
> if ( substring( $string , i , 1 ) eq "x" ) {
> # do something
> }
> 
> Ban Spam Now wrote in message <785i0u$odp@sjx-ixn6.ix.netcom.com>...
 ...
> >Given a string of length 0 to n
> >
> >How do I loop through the string character by character and perform an
> >operation based on the current character?
> >
> >in pseudo code
> >
> >for i = 1 to length(string)
> >  if string(i) = "M" do something
> >  if string(i) = "E" do something
> >end for
> >
> >how to do it in Perl?

I don't think doing it a character at a time with substr is doing it in 
Perl -- more like C.  The following is a Perl approach (which is 
designed to handle efficiently many more than two cases):

#!/usr/local/bin/perl -w
use strict;

sub do_E { print "got E\n" }

sub do_M { print "got M\n" }

my %dispatch = ( E => \&do_E, M => \&do_M );  # etc.

my $string = 'xMxExMx';
foreach (split //, $string) {
    &{$dispatch{$_}} if $dispatch{$_};
}

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


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

Date: Wed, 20 Jan 1999 20:14:22 GMT
From: droby@copyright.com
Subject: Re: Perl Criticism
Message-Id: <785dek$ras$1@nnrp1.dejanews.com>

In article <36A4DFF5.9F05184F@lmco.com>,
  James B Crigler <james.b.crigler@lmco.com> wrote:
> Replying to topmind, Daniel Grisinger wrote:
>
> > >                                      Do you all use only one
> > > language and/or always keep them strait?
> >
> > >                                           (I am sure a few
> > > do keep them strait, but don't exprapolate your greatness
> > > in such a narrow area to everybody else.)
> >
> > Ability to use your tools is not a sign of greatness.
>
> Including basic knowledge of spelling and grammar (and sometimes
> gramper! ;-) should be included in the toolset.  Topmind is
> evidently lacking in these, to wit:  s/strait/straight/
> and s/exprapolate/extrapolate/.  The latter even a spelling checker
> would have caught.

This thread is bad enough without going into a spelling and grammar war.

And topmind's logic is bad enough that we don't need to resort to that.

Anyway, it's supposed to be over.  Hitler has been invoked.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 20 Jan 1999 23:01:04 GMT
From: "sysadmin" <charlesjourdan@worldnet.att.net>
Subject: Perl from the Market viewpoint
Message-Id: <785n7g$c8q@bgtnsc02.worldnet.att.net>

If this question is inappropriate to this newsgroup,  i apologize;
If anyone could help me please:

If I wanted to focus on programming Perl in a UNIX environment, could I
expect to a make a living just doing that?
What kind of work is out there where the focus is Perl and UNIX, and what
types of industries/companies are looking for this kind of  narrow (?)
skillset?

Again, apologies if this is an inappropriate question to post here.  If so,
is there another perl newsgroup where I should post this?
Thanks
Joe

--
===========================================
Opinions my own and not representative of my employer
Do not listen to me: I have brain damage
===========================================





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

Date: Wed, 20 Jan 1999 23:31:16 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl from the Market viewpoint
Message-Id: <8Htp2.49$Rq1.4085@nsw.nnrp.telstra.net>

In article <785n7g$c8q@bgtnsc02.worldnet.att.net>,
	"sysadmin" <charlesjourdan@worldnet.att.net> writes:

> If I wanted to focus on programming Perl in a UNIX environment, could I
> expect to a make a living just doing that?

I am not sure about that. Many people who program perl for a living,
are also proficient in a few other languages, or at least one. Many
are also very familiar with general computing issues (OS
administration, networking). I suppose that I would expect a mixed
skillset from someone whose main job would be to program perl stuff
for Unix platforms. Perl is just Perl. Perl for unix platforms
specifically suggests a thorough knowledge of the OS, which often
suggests a good knowledge of at least C.

I don't think I'd ever put a job opening out for a Unix/Perl
programmer. It would more likely be 'System administrator/programmer.
Unix (brand name). Strong Perl skills required.'

The focus would be on the Sysadmin part, not the perl part. For any
other type of programmer (application, client/server, CGI, gui,
whatever), I'd probably expect more than just one language.

> What kind of work is out there where the focus is Perl and UNIX, and what
> types of industries/companies are looking for this kind of  narrow (?)
> skillset?

I can't really answer that. All I can say is that in my experience
people are more often looking for someone with a bit wider skillset,
but that does not mean that there are no jobs out there.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Advertising:  The science of arresting
Commercial Dynamics Pty. Ltd.       | the human intelligence long enough to
NSW, Australia                      | get money from it.


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

Date: Thu, 21 Jan 1999 00:49:08 +0100
From: "J. Haglund" <jerker.haglund@mailbox.swipnet.se>
Subject: Re: Perl uses in NT
Message-Id: <VXtp2.33418$9S3.84299@nntpserver.swip.net>


Mike wrote in message <773m45$dt0$1@nnrp03.primenet.com>...
>Hi, I'm new to the Perl world. My boss, a unix administrator, suggested I
>learn some Perl and apply it to my NT administration. Could anyone show me
>where I could find some good examples or situations where I could use Perl
>in NT?
>



I found TieRegistry.pm very useful, see documentation in the
latest Activestate release. Here's how to set up
some file properties for '.pl'-files:

use Win32::TieRegistry( Delimiter=>"#", ArrayValues=>0 );

  # Don't change existing
  $Registry->{"HKEY_CLASSES_ROOT/.pl/"} and return;

  $Registry->{"HKEY_CLASSES_ROOT/.pl/"} = { "/" => "plfile"};
  $Registry->{"HKEY_CLASSES_ROOT/plfile/"} =
    {
     "/"     => "Perl Program",
     "DefaultIcon/" => {"/" => "$Perl"},
    };
  $Registry->{"HKEY_CLASSES_ROOT/abifile/Shell"} =
    {
     "Open/" => {"command/" => {"/" => "$Perl \"%1\""}},
    };
}

    /J. Haglund





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

Date: Wed, 20 Jan 1999 22:45:29 GMT
From: lchang@alum.mit.edu
Subject: Status of Threaded Perl
Message-Id: <785ma6$3lm$1@nnrp1.dejanews.com>

Hello,

I was wondering if anyone has any information on the status of threading
support in Perl 5.005.  I noticed that the documentation indicates that it
is
an "experimental" feature.  Have people been using it successfully or does
experimental really mean that it is very unreliable?  I am using Linux
2.0.36 and Perl 5.005_02.

Thanks very much,

Leo

Kindly cc: me at lchang2@yahoo.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 20 Jan 1999 21:36:02 GMT
From: vcuya@mindspring.com (Victor A. Cuya)
Subject: Sys::Syslog equivalent for Win32
Message-Id: <36a64bbf.7135600@news.mindspring.com>

After going thru the documentation, it seems that this extension is
Unix specific. Is there an equivalent for the Windows NT platform? If
not, any ideas on a workaround to accomplish the same?

Any ideas would be greatly appreciated.

Victor A. Cuya


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

Date: 20 Jan 1999 16:09:41 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: samc@empirewest.com (Sam Curren)
Subject: Re: which form of dbm to use?
Message-Id: <m34spm9e16.fsf@joshua.panix.com>

samc@empirewest.com (Sam Curren) writes:

> What method (DB_File, GDBM, etc.) does dbmopen use?

The one you tell it to.

    $ perldoc -f dbmopen

> Which is the best to use in my case?

    $ perldoc AnyDBM_File

You probably want to learn how to use tie().

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Wed, 20 Jan 1999 17:05:51 -0600
From: Robert Lang <rrl@mail.com>
Subject: Re: write is trimming trailing blanks?
Message-Id: <36A6614F.AE445BB9@mail.com>

Martien,

Thanks.  I guess that I should have included in my post that I knew that I
could sprintf.

My point is that this seems so un-perlish.  The best part about Perl (to me,
anyway) is that it does what I tell it to do.  It's rather presumptious for it
to trim the line of blanks.  That's _not_ what I told it to do.  What
difference does it make if the last character is an 'x' or a ' '?  Evidently,
quite a bit.  That's just wrong.....

Regards,

Robert Lang


Martien Verbruggen wrote:

> In article <36A6592B.2DD442D@mail.com>,
>         Robert Lang <rrl@mail.com> writes:
>
> > The records that we are writing must be 350 chars long.  (Padded with
> > blanks.)
>
> You could use sprintf for that.
>
> # perldoc -f sprintf
>
> Martien
> --
> Martien Verbruggen                  |
> Interactive Media Division          | I think I think, therefore I think I
> Commercial Dynamics Pty. Ltd.       | am.
> NSW, Australia                      |



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

Date: Wed, 20 Jan 1999 23:23:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: write is trimming trailing blanks?
Message-Id: <Jztp2.44$Rq1.4085@nsw.nnrp.telstra.net>

In article <36A6614F.AE445BB9@mail.com>,
	Robert Lang <rrl@mail.com> writes:

> Martien,
> 
> Thanks.  I guess that I should have included in my post that I knew
> that I could sprintf.

I misread your original post anyway. You were saying that a write
silently truncates trailing whitespace, which is already in the
scalar. I read it as if you wanted the format string to put in those
spaces for you. My fault.

Indeed, write does silently get rid of those spaces, both in 5.004_04
and 5.005_02. Neither the perlform or perlfunc#write documentation
seems to mention this at all. I have to agree with you that this may
be considered a bug.

However, the write/format stuff was never really intended for anything
else than producing simple reports. I personally never use it, unless
that is exactly what I want: a simple report. For any strict
formatting, I tend to use printf, sprintf and pack. I don't know of
any way around the format problem, and I doubt a bit that its
behaviour will change...

> My point is that this seems so un-perlish.  The best part about Perl
> (to me, anyway) is that it does what I tell it to do.  It's rather
> presumptious for it to trim the line of blanks.  That's _not_ what I
> told it to do.  What difference does it make if the last character
> is an 'x' or a ' '?  Evidently, quite a bit.  That's just wrong.....

Again, since the format stuff was only intended for simple reports,
trimming spaces may be exactly what is wanted behaviour. I am not
entirely sure about the rationale behind it.

It would be nice if there was some modifier that would allow you to
preserve spacing.

may be
Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd.       | selective about its friends.
NSW, Australia                      | 


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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