[10027] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3620 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 2 16:05:14 1998

Date: Wed, 2 Sep 98 13:00:49 -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           Wed, 2 Sep 1998     Volume: 8 Number: 3620

Today's topics:
    Re: 405 Error <yong@shell.com>
    Re: a pesky perl runtime problem <murrayb@vansel.alcatel.com>
        Class browser for Perl <mkolbuszewski@mail.cebra.com>
    Re: Currency Formatting in Perl (s//) <jdavey@epidigm.geg.mot.com>
    Re: eliminate *mostly* duplicate array elements (D. Dale Gulledge)
    Re: eliminate *mostly* duplicate array elements (D. Dale Gulledge)
    Re: eliminate *mostly* duplicate array elements (Craig Berry)
    Re: Help Converting to Lowercase (Craig Berry)
    Re: Help Converting to Lowercase (Jonathan Stowe)
        help with grep nana@my-dejanews.com
    Re: help with grep (Matthew Bafford)
        HELP: Forking perl script from C program. ? ankur@yahoo.com
    Re: How do I create a directory only if it doesn't exis <r.goeggel@atos-group.de>
    Re: How do I create a directory only if it doesn't exis (Tad McClellan)
    Re: How do I create a directory only if it doesn't exis (Michael J Gebis)
    Re: How do I create a directory only if it doesn't exis (Michael J Gebis)
        How to get a tmpfile? (RHS Linux User)
    Re: In search of Intellegint Life... HELP!! (Ripcord104)
    Re: In search of Intellegint Life... HELP!! (Craig Berry)
    Re: In search of Intellegint Life... HELP!! <jdporter@min.net>
    Re: Interpolating from a Template <75762.2332@CompuServe.COM>
        linux serial port programming with perl <priebe@wral-tv.com>
    Re: MKI$ & CVI functions in QBasic <jdporter@min.net>
    Re: MKI$ & CVI functions in QBasic (Jonathan Stowe)
    Re: MS Word to Text conversion <eashton@bbnplanet.com>
    Re: MS Word to Text conversion <rootbeer@teleport.com>
    Re: MS Word to Text conversion (Jonathan Stowe)
        Need Freeware Mail Form Halder for NT! <purvisb@mindspring.com>
    Re: opening web-page with perl <rootbeer@teleport.com>
    Re: Perl & Java - differences and uses <keshlam@us.ibm.com>
    Re: Perl & Java - differences and uses <->
    Re: Perl & Java - differences and uses <spamsux-tex@habit.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 02 Sep 1998 13:49:29 -0500
From: yong <yong@shell.com>
To: fioretti@my-dejanews.com
Subject: Re: 405 Error
Message-Id: <35ED9339.D6941EBF@shell.com>

405 is "Method not allowed". Try change POST to GET or GET to POST. It
would be helpful if you can post your program script here (or the relevant
part of it if it's too long). Other than this, you probably misconfigured
the server and you need to post a message to
comp.infosystems.www.servers.ms-windows.

Yong

fioretti@my-dejanews.com wrote:

> Hi,
> I'm using Winperl with Apache 1.3.1 for Windows 95.
> Why, when I want to run any CGI, I receive an error 405 from my server?
> I know it's MIME problem but, what's solution?
>
> Thanks!
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum



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

Date: 02 Sep 1998 11:37:32 -0700
From: Brad Murray <murrayb@vansel.alcatel.com>
Subject: Re: a pesky perl runtime problem
Message-Id: <ubtoygy37.fsf@vansel.alcatel.com>

John Porter <jdporter@min.net> writes:

> Jonathan Feinberg wrote:
> > 
> > "E Mills, software scientist" <eam@starfire.mlb.semi.harris.com> writes:
> > 
> > > I just chased down a bug which was innocuous.
> > 
> > I do not think that word means what you think it means.
> 
> Prepare to die...

Inconceivable!

-- 
Brad Murray      "This is one of the reasons you're such big hits at
Software Analyst  your parents' parties: being a good conversationalist
Alcatel Canada    is really what a liberal arts education is all about."


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

Date: Wed, 02 Sep 1998 15:23:58 -0400
From: Marcin Kolbuszewski <mkolbuszewski@mail.cebra.com>
Subject: Class browser for Perl
Message-Id: <35ED9B4E.B0AF662A@mail.cebra.com>

Hi there!

I am looking for a class browser for Perl - just like used in Smalltalk,
Java and other
OO languages. I am looking for no more than just basic three pane
browser.
The left upper pane for classes, right upper for variables and methods,
and bottom for
source of the currently highlighted class/method.

Sincerely,


Marcin Kolbuszewski
Merx/Cebra
mkolbuszewski@mail.cebra.com




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

Date: Wed, 02 Sep 1998 11:01:39 -0700
From: Jeff Davey <jdavey@epidigm.geg.mot.com>
Subject: Re: Currency Formatting in Perl (s//)
Message-Id: <35ED8803.BC10E6A2@epidigm.geg.mot.com>

S. Kuip wrote:
> 
> Jeff Davey wrote:
> >S. Kuip wrote:
> >> 1 while $amount =~ s/(.*\d)(\d\d\d)/$1,$2/;
> >>
> >> 1204846335 => 1,204,846,335
> >>
> >
> >Not quite - this only puts the thousands comma delineator in.  Anyone
> >else?
> 
> It works fine for me!!
> 
> --
> Stefan

My mistake.  I left out the "1 while".  That's a newbie for you.  ;-)

-- 
**********************************************************
Name:     Jeffrey J. Davey
Title:    Software Engineer
Company:  QRP
Internet: jdavey@epidigm.geg.mot.com
Voice:    (602) 441-6708
**********************************************************


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

Date: 02 Sep 1998 13:33:14 -0400
From: ddg@nortel.com (D. Dale Gulledge)
Subject: Re: eliminate *mostly* duplicate array elements
Message-Id: <wk4suqs9lx.fsf@nortel.com>

"Phil R Lawrence" <prl2@lehigh.edu> writes:

> I grabbed the following from the FAQ to eliminate duplicate array elements:
> 
>     undef %saw;
>     @list = grep(!$saw{$_}++, @raw_list);
> 
> However, I need to eliminate duplicate array elements *even* if they have differing whitespace.  (So I guess they would be mostly
> duplicate.)
> 
> Example:  Keep only one of the following:
> 
> "                     hallo"
> "      hallo           "
> 
> Any ideas?  I'm a little dim on how the FAQ solution actually works, so I'm pretty much in the dark about modifying it.

I sent Phil a longer explanation in case he doesn't like the exact results I
produced.  The short version is:
	
	undef %saw;
	@list = grep{ $tmp = $_;
		      $tmp =~ s/[ \t]+//g;
		      !$saw{$tmp}++; } @raw_list;

$tmp is used to make sure that the spaces are still there in the values that
are actually stored in @list.

- Dale (JAPH)



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

Date: 02 Sep 1998 14:21:20 -0400
From: ddg@nortel.com (D. Dale Gulledge)
Subject: Re: eliminate *mostly* duplicate array elements
Message-Id: <wk3eaas7dr.fsf@nortel.com>

ddg@nortel.com (D. Dale Gulledge) writes:

> $tmp is used to make sure that the spaces are still there in the values that
> are actually stored in @list.

Do I get extra credit for coming up with the answer Phil really wanted?

- Dale


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

Date: 2 Sep 1998 19:15:38 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: eliminate *mostly* duplicate array elements
Message-Id: <6sk5gq$o61$1@marina.cinenet.net>

Phil R Lawrence (prl2@lehigh.edu) wrote:
: I grabbed the following from the FAQ to eliminate duplicate array elements:
: 
:     undef %saw;
:     @list = grep(!$saw{$_}++, @raw_list);
: 
: However, I need to eliminate duplicate array elements *even* if they
: have differing whitespace.  (So I guess they would be mostly
: duplicate.)
: 
: Example:  Keep only one of the following:
: 
: "                     hallo"
: "      hallo           "
: 
: Any ideas?  I'm a little dim on how the FAQ solution actually works, so
: I'm pretty much in the dark about modifying it. 

The FAQ trick (and my code's trick also) is to use a hash to keep track of
what elements have been seen.  If an element has been seen before, it
isn't added again.


#!/usr/bin/perl -w
# rmdupws - remove duplicates from an array, disregarding whitespace
# Craig Berry (19980902)

use strict;

sub rmDupsIgnoreWS
{
  my $ar = shift;
  my %seen;
  my @keys;   # Used to preserve ordering.

  foreach my $elem (@$ar) {
    (my $elemNoWS = $elem) =~ s/\s//g;  # Could use tr, but \s is easy.

    unless (exists $seen{$elemNoWS}) {
      $seen{$elemNoWS} = $elem;
      push @keys, $elemNoWS;
    }
  }

  # Replace the right side of the next assignment with '@keys' to
  # store back the whitespace-stripped versions, rather than the
  # first version found with whitespace intact.

  @$ar = @seen{@keys};
}


# Test code follows

chomp(my @test = <DATA>);

rmDupsIgnoreWS(\@test);

print join("\n", @test), "\n";

__DATA__
'   hello       '
' hello'
world  ofmine
'hello  '
worl  dofm ine
'   he ll o'
this is a test
Wow.
thisis      a test


---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: 2 Sep 1998 18:04:18 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Help Converting to Lowercase
Message-Id: <6sk1b2$d1c$2@marina.cinenet.net>

Dexter Maxwell (dexter@coolcounter.com) wrote:
: Can anyone help me???  I need to be able to convert a variable to all lower
: case.  It seems simple, but I can't get it to work.  Here's what I've got:
: 
: $data = $ENV{'QUERY_STRING'};
: while (<>) { tr/A-Z/a-z; }
: print "$data\n";
: exit;
: 
: Thanks for your help!

(a) I have no idea what you're trying to do with that code, but I doubt
    it's doing what you think it is.
(b) What happened when you did the obvious thing, and ran
    'perldoc perlfunc | grep lowercase'?  (Or used your own favorite
    search tool/method to look in perlfunc?)

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Wed, 02 Sep 1998 18:51:33 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Help Converting to Lowercase
Message-Id: <35ed8ed4.5612071@news.btinternet.com>

On Wed, 2 Sep 1998 06:42:11 -0700, Dexter Maxwell wrote :

>Can anyone help me???  I need to be able to convert a variable to all lower
>case.  It seems simple, but I can't get it to work.  Here's what I've got:
>
>$data = $ENV{'QUERY_STRING'};
$data = lc($data);

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Wed, 02 Sep 1998 18:22:38 GMT
From: nana@my-dejanews.com
Subject: help with grep
Message-Id: <6sk2de$4mi$1@nnrp1.dejanews.com>

I have two arrays: @words and @strings. I want to match any of @words to any
of @strings and in case they match, exit.

foreach (@words) {
	if ( grep ( /$_/i, @strings ) ) { die; }
	}

I guess this isn't right. I can't really figure out what is wrong, does grep
change the value of $_? and what does grep return when no match is found?

thanks

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 2 Sep 1998 15:11:31 -0400
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: help with grep
Message-Id: <MPG.10576256b22a0f29989684@news.south-carolina.net>

In article <6sk2de$4mi$1@nnrp1.dejanews.com> on Wed, 02 Sep 1998 
18:22:38 GMT, nana@my-dejanews.com (nana@my-dejanews.com) pounded 
in the following text:
=> I have two arrays: @words and @strings. I want to match any of @words to any
=> of @strings and in case they match, exit.
=> 
=> foreach (@words) {
=> 	if ( grep ( /$_/i, @strings ) ) { die; }
=> 	}
=> 

Ugh...

Let's see:

	1) foreach in this form sets $_ to the current string.
	2) grep sets $_ to the current string being evaluated.
	3) Your regex makes no sense.  The default argument for
          m// is $_.  So, your saying: $_ =~ m/$_/i?
	4) This finds not if the current word matches the current
          string, but rather does the current string contain the
          current word. If the rest was correct, that is.
	5) Die by it's self isn't very informative... :)

=> I guess this isn't right. I can't really figure out what is wrong, does grep
=> change the value of $_? and what does grep return when no match is found?

R.T.F.M. (Read the _FREE_ Manual)

=> thanks

No Problem.  While I'm at it, here's a rewrite (in the style you 
used above).

This is just one method, look in the FAQ for more (efficient 
ones)...

#!/usr/bin/perl -w

use strict;

my @GoodWords = qw(LLama Camel Wall Christiansen Schwartz);

while ( defined($CurrentWord = <DATA>) )
{
	chomp $CurrentWord;
	
	print "$CurrentWord matched!\n"
		if grep { lc($CurrentWord) eq lc($_) } @GoodWords;
}

__DATA__
Larry
ChriSTIAnsin
WALL
cameL
llaMas
lLama
Schwartz
Christiansen
Bafford
__END__


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

Date: Wed, 02 Sep 1998 19:10:18 GMT
From: ankur@yahoo.com
Subject: HELP: Forking perl script from C program. ?
Message-Id: <6sk56p$8c0$1@nnrp1.dejanews.com>

Hello:

I want to fork a perl script from my C program (Solaris 2.5/ perl 5.0404).
Currently my perl script dies when C program exits. How can I make
sure that perl script keeps running even if C program dies.
Here's my C program,

    if (fork() == 0)
	{
	setsid();
	execvp('perl script');
	exit();
	}
     ..continue..

I read FAQ and tried following in my perl script but it did not solve the
problem.  * Open /dev/tty and use the the TIOCNOTTY ioctl on it. See the
tty(4)	     manpage for details.  * Change directory to /  * Reopen STDIN,
STDOUT, and STDERR so they're not connected to the old tty.  * Background
yourself like this:  fork && exit;

When I do 'ps' it appears that perl script has 1 as its parent process
and is detached from tty. Stiil when C program exists, perl script dies.

You help is greatly appreciated.

Thanks,

Ankur Shah
ankur@yahoo.com

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 2 Sep 1998 18:50:01 +0200
From: "Ronald Gvggel" <r.goeggel@atos-group.de>
Subject: Re: How do I create a directory only if it doesn't exists
Message-Id: <6sjt3s$jbh$1@news.pop-stuttgart.de>


Rolf Rettinger schrieb in Nachricht <6sissb$44i$1@claire.desy.de>...
>Hi,
>
>is there any function like sysopen for a file to create a directory
only if
>it doesn't exists?
>
>Thanks Rolf
>


No, but there is a functin to check if a directory exists. If it does
you don't have to create.

HTH
Ronald




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

Date: Wed, 2 Sep 1998 11:10:07 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How do I create a directory only if it doesn't exists
Message-Id: <vkqjs6.86j.ln@metronet.com>

Rolf Rettinger (rolf.rettinger@desy.de) wrote:

: is there any function like sysopen for a file to create a directory only if
                             ^^^^^^^
                             ^^^^^^^
                             ^^^^^^^
: it doesn't exists?


   What did you find when you did a word search in the docs
   that come with perl?

   ( you should have found sysopen(). Surprise! )



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


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

Date: 2 Sep 1998 18:28:53 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: How do I create a directory only if it doesn't exists
Message-Id: <6sk2p5$mje@mozo.cc.purdue.edu>

lr@hpl.hp.com (Larry Rosler) writes:

}[Posted to comp.lang.perl.misc and copy mailed.]

}In article <6sissb$44i$1@claire.desy.de> on Wed, 2 Sep 1998 09:41:56 
}+0200, Rolf Rettinger <rolf.rettinger@desy.de> says...
}> is there any function like sysopen for a file to create a directory only if
}> it doesn't exists?

}Why not just test for its existence before trying to make it?

}mkdir $dir, 0777 or die "Couldn't mkdir $dir. $!" unless -d $dir;

}That will cause a problem if $dir exists but is a file, so you might want 
}to elaborate the test to meet your needs.

There's actually a (probably minor) race condition where two separate
processes could detect that the directory doesn't exist before either
gets a chance to create it.  Be sure to check the result of mkdir if
this is an issue.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: 2 Sep 1998 18:32:46 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: How do I create a directory only if it doesn't exists
Message-Id: <6sk30e$mpp@mozo.cc.purdue.edu>

tadmc@metronet.com (Tad McClellan) writes:

}Rolf Rettinger (rolf.rettinger@desy.de) wrote:

}: is there any function like sysopen for a file to create a directory only if
}                             ^^^^^^^
}: it doesn't exists?
}   What did you find when you did a word search in the docs
}   that come with perl?
}   ( you should have found sysopen(). Surprise! )

The question stems from the fact that he's trying to create a
directory, not a file.  sysopen AFAIK can't do this.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: 2 Sep 1998 19:36:05 GMT
From: skytree@skytree.admin.yzu.edu.tw (RHS Linux User)
Subject: How to get a tmpfile?
Message-Id: <6sk6n5$8dj$1@news.yzu.edu.tw>

i have read the perlfaq5. the simple way is to
use IO::Handle::new_tmpfile
but i still don't get it!

would you show me a example the use IO::Handle::new_tmpfile ? thx! :)


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

Date: 2 Sep 1998 18:57:06 GMT
From: ripcord104@aol.com (Ripcord104)
Subject: Re: In search of Intellegint Life... HELP!!
Message-Id: <1998090218570700.OAA10032@ladder01.news.aol.com>


>2) Misspelling 'intelligent' in a meaningless subject line just leaves you
>   wide-open to abuse...or worse, being ignored.
>

heh... oops..


>: sub HTML_Footer
>: {
>:               print "\n", "</BODY", "\n";
>:               print "", "\n";
>: }
>
>How that subroutine body is better than
>
>  print "\n\n\n";
>

I think there was supposed to be "</HTML>" in that second print line...  not
null..

>How much time have you wasted on this,

I don't know but I find  it humorous how much time you wasted trying to hammer
me down, when all that was required was this small tiny line that was already
posted by 4 other users with less of a need to mark their territory with
derogatory remarks.  I salute and move on.


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

Date: 2 Sep 1998 19:21:05 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: In search of Intellegint Life... HELP!!
Message-Id: <6sk5r1$o61$2@marina.cinenet.net>

Ripcord104 (ripcord104@aol.com) wrote:
: >How much time have you wasted on this,
: 
: I don't know but I find  it humorous how much time you wasted trying to
: hammer me down, when all that was required was this small tiny line that
: was already posted by 4 other users with less of a need to mark their
: territory with derogatory remarks.  I salute and move on.

Dude, I am nearing the point of giving up.  I wan't "hammering you down;"
I was trying to show you how to answer questions like the one you asked
about a thousand times faster.  Pardon me for my attempt, on my own time,
to make your life easier and more productive.  Rest assured it won't
happen again.

Hee...I just flashed on a new slogan for clpm:  "Perls Before Swine." :)

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Tue, 01 Sep 1998 16:00:59 -0400
From: John Porter <jdporter@min.net>
Subject: Re: In search of Intellegint Life... HELP!!
Message-Id: <35EC527B.D4CC9E7B@min.net>

Ripcord104 wrote:
> 
> >: sub HTML_Footer
> >: {
> >:               print "\n", "</BODY", "\n";
> >:               print "", "\n";
> >: }
> >
> >How that subroutine body is better than
> >
> >  print "\n\n\n";
> >
> 
> I think there was supposed to be "</HTML>" in that second print line...  not
> null..

There was when he posted it.  Apparently your news reader
stripped it out, probably trying to render it as actual markup.
That's what you get....

John Porter


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

Date: Wed, 02 Sep 1998 13:50:28 -0400
From: Ruben Safir <75762.2332@CompuServe.COM>
Subject: Re: Interpolating from a Template
Message-Id: <uyNDtop19GA.176@nih2naac.prod2.compuserve.com>


Thanks.

I ran a line like this to make it work...


s/(html_txt\[\d+\])/$1/eg;


Ruben


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

Date: Wed, 02 Sep 1998 15:30:32 -0400
From: Jason Priebe <priebe@wral-tv.com>
Subject: linux serial port programming with perl
Message-Id: <35ED9CD8.2DF4568E@wral-tv.com>

Pardon the cross-post, but I'm not sure if this is a system issue or a
Perl issue.  I'm using a RH 5.0 Linux box (x86) to communicate with a
Davis Instruments Weather Monitor II.  My intent is to collect real-
time weather data for online publication.

I am having problems communicating with the box.  I've tried just about
every combination of arguments to stty to get things to work, with no
real success.

Basically, what I was seeing was that the first command I sent to the
Weather Monitor after turning it on would be received fine.  I got an
ACK and the requested data.  Every subsequent command was not
understood by the WM, (I got the ascii 33 decimal from the WM, its
response when it doesn't understand a command).

I found after _much_ trial-and-error that if I closed the serial port
after issuing the command and reading the results, then opened the
port again using sysopen(), sent a null command, and closed the port,
I could then issue another command to the WM, and it would understand!
It seems that the sysopen() call reset something on the communication
line.

So the sysopen() seems to flush something, but the communications are
still a bit flaky, so I had to add the select() call to pause after
each reading.  Even with that, I'm seeing some values misread.  I'd
appreciate _any_ insight!   TIA

BTW -- the WM has been used sucessfully with the bundled 32-bit windows
software, so the hardware definitely works properly.

Here's my code if anybody is interested:

#!/usr/local/bin/perl
####---------------------------------------------------------------------------
####---------------------------------------------------------------------------
use Fcntl

$cr = 0x0d;

`stty sane`;
`stty raw -clocal 2400 < /dev/$dev`;

if(&send_command('WRD', chr(0x22) . chr(0x5e), 1))
{
  $wind_speed = unpack('C', $buffer);
  print "wind speed = $wind_speed\n";
}

####---------------------------------------------------------------------------
####---------------------------------------------------------------------------
sub send_command
{
  my ($command, $args, $bytes_expected) = @_;
  my $retval = 1;

  #### open serial port and unbuffer input
  open(PORT, "+</dev/ttyS0")
   || die "Can't open port 1 for read/write:$!\n";
  select(PORT); $| = 1;
  select(STDOUT);

  print PORT "$command$args$cr";

  if(&get_ack())
  {
    $num_bytes_read = read(PORT, $buffer, $bytes_expected);
    ($num_bytes_read != $bytes_expected) && ($retval = 0);
  }
  else
  {
    $retval = 0;
  }

  close(PORT);

  #### somehow, this stuff seems to flush something that the stuff
  #### above leaves open....
  sysopen(PORT, "/dev/$dev", O_RDWR|O_NDELAY|O_NOCTTY);
  print PORT "$cr";
  &get_ack();
  close(PORT);
 
  #### sleep for 1/2 second
  select(undef, undef, undef, 0.5);

  $retval;
}

####---------------------------------------------------------------------------
####---------------------------------------------------------------------------
sub get_ack
{
  $num_bytes_read = read(PORT, $reply, 1);

  $reply_num = unpack('C', $reply);
  if($reply_num == 0x06)
  {
    #print "command was understood ($reply, $reply_num).\n";
    return 1;
  }
  else
  {
    #print "command was not understood ($reply, $reply_num).\n";
    return 0;
  }
}


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

Date: Tue, 01 Sep 1998 14:05:26 -0400
From: John Porter <jdporter@min.net>
Subject: Re: MKI$ & CVI functions in QBasic
Message-Id: <35EC3766.C204E6A2@min.net>

xvisualbasic@my-dejanews.com wrote:
> 
> I would like to know the equivalent functions of MKI$ & CVI of QBasic in Perl.
> MKI$ converts numbers into numeric strings and CVI does the reverse.

Read the perldata document (type perldoc perldata at your command
prompt),
especially the section called "Scalar values".

After you've digested that, then come back here with a more relevant
(i.e. "perl-enlightened") question.

Thanks.

John Porter


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

Date: Wed, 02 Sep 1998 18:51:30 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: MKI$ & CVI functions in QBasic
Message-Id: <35ed89a9.4450737@news.btinternet.com>

On Wed, 02 Sep 1998 14:48:49 GMT, xvisualbasic@my-dejanews.com wrote :

>I would like to know the equivalent functions of MKI$ & CVI of QBasic in Perl.
>MKI$ converts numbers into numeric strings and CVI does the reverse.
>

For all practical purposes no such functions are required in Perl
because Perl has no separate types for strings and numbers.  Given a
string that looks like a number, Perl will treat it *as* a number when
used in an arithmetic expression.  Likewise a number used in a string
expression will be dealt with correctly.

There is however a special "magical increment" which is illustrated
thus:

#!perl

$string = "00001";

for ( 0 ... 9)
{
  print $string++,"\n";
}

$string = "00001";

for ( 0 ... 9)
{
  print $string + $_,"\n";
}
__END__

Which will output:

00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
1
2
3
4
5
6
7
8
9
10

I would suggest that you read the Perl Documentation further and or
get hold of a good book on the subject.

And forget everything you know about QBasic.

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Wed, 02 Sep 1998 17:58:45 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: MS Word to Text conversion
Message-Id: <35ED8500.BB086A6B@bbnplanet.com>

> I'm in urgent need of a Perl module/script (heck, any command line
> application) that can be used to convert larger numbers of MS Word
> (.doc) documents into plain text (.txt) files. Anyone know of such a
> critter? Thanks.

try this. laola. i loathe ms word and in a corp world where everyone
uses the bloody thing it comes in really handy.

http://user.cs.tu-berlin.de/~schwartz/pmh/

e.


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

Date: Wed, 02 Sep 1998 18:00:53 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: MS Word to Text conversion
Message-Id: <Pine.GSO.4.02A.9809021100360.29974-100000@user2.teleport.com>

On Wed, 2 Sep 1998, Ernie Mercer wrote:

> I'm in urgent need of a Perl module/script (heck, any command line
> application) that can be used to convert larger numbers of MS Word
> (.doc) documents into plain text (.txt) files. Anyone know of such a
> critter? 

If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 02 Sep 1998 19:30:16 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: MS Word to Text conversion
Message-Id: <35ed9be9.8900376@news.btinternet.com>

On Wed, 02 Sep 1998 17:10:56 GMT, Ernie Mercer wrote :

>I'm in urgent need of a Perl module/script (heck, any command line
>application) that can be used to convert larger numbers of MS Word
>(.doc) documents into plain text (.txt) files. Anyone know of such a
>critter? Thanks.

Yeah, Word.  Well ok its not a Command line application but you could
concievably create a VBA script to read in doc files and save them as
plain text.  Alternatively you could look at Win32::OLE to automate
Word to do the job.  

/J\
-- 
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Wed, 02 Sep 1998 14:31:24 -0400
From: Byron Purvis <purvisb@mindspring.com>
Subject: Need Freeware Mail Form Halder for NT!
Message-Id: <35ED8EFC.ECE69949@mindspring.com>

Hi, I've looked all over the place but only seem to find unix perl
scripts. I need something that doesn't depend on sendmail to do its
dirty work. I have found compiled cgi files that will do the job, but
they leave me know way to customise them :( Can anyone point me in the
right direction?
Thanks in advance!!
-Byron

-----------------------
 Byron Purvis
 purvisb@mindspring.com
-----------------------




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

Date: Wed, 02 Sep 1998 17:53:32 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: opening web-page with perl
Message-Id: <Pine.GSO.4.02A.9809021049570.29974-100000@user2.teleport.com>

On Wed, 2 Sep 1998, Kari Nevalainen wrote:

> how can you open certain URL in you browser?

Check your browser's documentation.

> If I would like to open my English homepage to people who does NOT come
> from Finland and open my Finnish homepage to people who do.
> 
> How should I program that with Perl?

Ask people to tell you where they come from; there's no way to be correct
otherwise. After all, you're asking where the _people_ come from, not
where their bytes happen to be coming from.

Of course, there's nothing Perl-specific about this. This would all be the
same if you were programming in any other language. If you have more
questions about CGI programming, the docs, FAQs, and newsgroups about that
should be helpful. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 02 Sep 1998 14:46:21 -0400
From: "Joseph Kesselman, yclept Keshlam" <keshlam@us.ibm.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <35ED927D.CE97825B@us.ibm.com>

And as an old programmer, I'd add:
	Never ask _anywhere_ "which language is better".
	That's not a meaningful question. First state
	precisely what your problem domain is, and
	what the constraints upon it are; you can then
	discuss the advantages and disadvantages of
	individual languages for that specific
	application.

	_ALL_ languages can argue that they're "better" in
	one way or another. If they couldn't, they wouldn't
	still exist. The question is whether they do what
	you want to do and in the way that you want to do it.
-----------------------------------------------------------------
Joe Kesselman ("Keshlam"), http://www.lovesong.com/people/keshlam
     New URL for Walkabout Clearwater Coffeehouse and Chorus:
		http://www.lovesong.com/walkabout


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

Date: Wed, 2 Sep 1998 19:52:58 +0100
From: "Jim" <->
Subject: Re: Perl & Java - differences and uses
Message-Id: <35ed93c2.0@news.netcom.co.uk>

I was originally only going to ask clpm but didn't want a biased opinion,
thats also why I asked for references to info. We're all big boys, I'm sure
we can discuss these things maturely, isn't that what usenet is all about?

I do admit though, provocative question.

Jim




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

Date: Wed, 02 Sep 1998 12:40:44 +0000
From: Austin Schutz <spamsux-tex@habit.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <35ED3CCC.1D1C@habit.com>

David Cantrell wrote:
> 
> On Wed, 2 Sep 1998 12:46:46 +0100,
>   "Jim" <-> enlightened us thusly:
> 
> >As a young(17) and budding internet page designer I have often been told
> >"forget the rest, learn Java" when asking about programming for the net,
> 
> Whoever told you that was a fool.
> 
> >this is also the message Internet magazines tend to give.
> 
> Mass-market magazines aren't exactly renowned for being the fount of
> all wisdom and knowledge ;-)
> 
> >                                                           However having
> >recently been learning Perl(and loving it) I am curious as to the power Java
> >has over Perl
> 
> In some areas, perl is very strong (particularly text handling) and
> java is weak.  In others, java is very strong (for instance, GUIs) and
> perl is weak.
> 
> And before anyone jumps on me, yes I _am_ aware of perl/tk - and of
> com.stevesoft.pat and oromatcher for doing regexes in java.
> 
> > what the main uses are and the main differences are, will
> >Perl eventually be replaced by Java?
> 
> No.  For the same reason as why fish will never replace squid in the
> oceans.  They inhabit different environmental niches - although there
> is some overlap.
> 

	If you are looking for a language with greater overlap you
might consider trying python (http://www.python.org/). One of the latest
and coolest things you can do with python is compile it in to java
bytecode.

	Austin


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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