comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
February 2008
motuwethfrsasuw
    123 5
45678910 6
11121314151617 7
18192021222324 8
2526272829   9
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.perl.misc Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Re: Newbie: Non-interactive status displays - HOWTO?         


Author: MK
Date: Feb 17, 2008 20:04

On Tue, 05 Feb 2008 11:43:55 -0600, Chris wrote:
> I'm a perl Tk newbie trying to create a pgm to display the status of
> several servers by a green/red indicator light. After going over some
> howto's & examples, I'm still stumped.
>
> All of the examples...
Show full article (1.06Kb)
no comments
  Regular Expression to Replace UPPER Case Text with lower case text         


Author: penny
Date: Feb 17, 2008 18:42

Is there a way in Regular Expressions to convert a string that is all
in upper case - and replace it with it's lower case equivalent?

I can do something like ([A-Z][A-Z]+\x?) to match any given word and
reference it as \1, however without using programming language lcase
or LOWER functions on it - how can I use reg ex to convert the text to
it's lower case equivalent??

Thanks - (I use coldfusion but the regular expression syntax is
similar)
29 Comments
  FAQ 4.2 Why is int() broken?         


Author: PerlFAQ Server
Date: Feb 17, 2008 18:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

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

4.2: Why is int() broken?

Your "int()" is most probably working just fine. It's the numbers that
aren't quite what you think.

First, see the answer to "Why am I getting long decimals (eg,
19.9499999999999) instead of the numbers I should be getting (eg,
19.95)?".

For example, this

print int(0.6/0.2-2), "\n";

will in most computers print 0, not 1, because even such simple numbers
as 0.6 and 0.2 cannot be presented exactly by floating-point numbers.
What you think in the above as 'three' is really more like
2.9999999999999995559.

--------------------------------------------------------------------
Show full article (1.57Kb)
1 Comment
  bash and perl         


Author: David Williams
Date: Feb 17, 2008 17:49

I don't think my first message went through.
Wondering if there is a way to mix perl and shell scripts?

Like this:

#!/usr/bin/perl

.
.
.

#!/bin/bash
.
.
.
I tried this above but Perl did not like it.

David

--
David Williams
Georgia Institute of Technology, Atlanta Georgia, 30332
Email: dw149@prism.gatech.edu
8 Comments
  FAQ 3.29 When I tried to run my script, I got this message. What does it mean?         


Author: PerlFAQ Server
Date: Feb 17, 2008 12:03

This is an excerpt from the latest version perlfaq3.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

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

3.29: When I tried to run my script, I got this message. What does it mean?

A complete list of Perl's error messages and warnings with explanatory
text can be found in perldiag. You can also use the splain program
(distributed with Perl) to explain the error messages:

perl program 2>diag.out
splain [-v] [-p] diag.out

or change your program to explain the messages for you:

use diagnostics;

or

use diagnostics -verbose;

--------------------------------------------------------------------
Show full article (1.46Kb)
no comments
  Linux, IO::Socket::INET and recv'ing broadcasted UDP         


Author: DJ Stunks
Date: Feb 17, 2008 07:24

Hey all, it's been a while since I hung out here but I still use Perl
from time to time (and miss using it!).

Anyway, I originally posted this question at comp.lang.perl.modules
but I'm not getting any responses and I'm not sure it's a modules
question anyway - maybe more a socket/Linux problem.

Original post here (includes code):

http://groups.google.com/group/comp.lang.perl.modules/msg/8ce530096fe7fdac?

In summary, I'm attempting to use Net::DHCP::Packet and
IO::Socket::INET to generate, transmit and receive DHCP messages
(discover, offer, request, ack). The problem is that I'm not able to
use the IO::Socket recv method to receive a broadcasted DHCP offer
packet. My script blocks indefinitely though I see the offer arrive
via Wireshark.

I'm following the example from the Net::DHCP::Packet package and, in
Googling, no one else mentions issues with this. Therefore I assume
that the error is on my part - probably a simple error - but I don't
know enough to diagnose it.
Show full article (1.26Kb)
7 Comments
  FAQ 3.25 Where can I learn about CGI or Web programming in Perl?         


Author: PerlFAQ Server
Date: Feb 17, 2008 06:03

This is an excerpt from the latest version perlfaq3.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

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

3.25: Where can I learn about CGI or Web programming in Perl?

For modules, get the CGI or LWP modules from CPAN. For textbooks, see
the two especially dedicated to web stuff in the question on books. For
problems and questions related to the web, like "Why do I get 500
Errors" or "Why doesn't it run from the browser right when it runs fine
on the command line", see the troubleshooting guides and references in
perlfaq9 or in the CGI MetaFAQ:

http://www.perl.org/CGI_MetaFAQ.html

--------------------------------------------------------------------
Show full article (1.49Kb)
no comments
  FAQ 4.1 Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I should be getting (eg, 19.95)?         


Author: PerlFAQ Server
Date: Feb 17, 2008 00:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

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

4.1: Why am I getting long decimals (eg, 19.9499999999999) instead of the numbers I should be getting (eg, 19.95)?

Internally, your computer represents floating-point numbers in binary.
Digital (as in powers of two) computers cannot store all numbers
exactly. Some real numbers lose precision in the process. This is a
problem with how computers store numbers and affects all computer
languages, not just Perl.

perlnumber shows the gory details of number representations and
conversions.

To limit the number of decimal places in your numbers, you can use the
printf or sprintf function. See the "Floating Point Arithmetic" for more
details.

printf "%%.2f", 10/3;

my $number = sprintf "%%.2f", 10/3;
Show full article (1.74Kb)
no comments