testing if hardware is avalible

2007-07-19 Thread Gregory Machin
Hi can you advise on the best way test if a usb modem is plugged in ? I though about checking if the file/node /dev/ttyACM0 is present, as it's created when the device is plugged in using open (TEST, "/dev/tty/ACM0"); but just concecned if i do this while the device is acitive it will cause it to

script won't write to file ...

2007-07-19 Thread Gregory Machin
Hi I have a script that i'm working on, I want it to write info to a log file, but I can't get it to write to the file.. I run the script as root, and I also chmod 0777 the file but still no out put ... what have it missed .. ___script___ #!/usr/bin/perl print "hello"; use use strict; #p

Re: Extreme beginner question on reading lines from a file.

2007-07-19 Thread Jeff Pang
--- Ryan <[EMAIL PROTECTED]> wrote: > What is a lexical file handle? I'm working my way > through Ford's "Perl > Programming for the Absolute Beginner" (2007) and > Lee's "Beginning Perl" > (2004), and they both use the FH style of file > handle. >From perl 5.6 you can say, open my $fh,"te

Re: Extreme beginner question on reading lines from a file.

2007-07-19 Thread Chas Owens
On 7/19/07, Ryan <[EMAIL PROTECTED]> wrote: What is a lexical file handle? I'm working my way through Ford's "Perl Programming for the Absolute Beginner" (2007) and Lee's "Beginning Perl" (2004), and they both use the FH style of file handle. Should I do differently? snip Yes, you should use

Re: The role of listen()

2007-07-19 Thread Jeff Pang
--- "John W. Krahn" <[EMAIL PROTECTED]> wrote: > Peter Scott wrote: > > On Wed, 18 Jul 2007 17:49:52 +, Monty wrote: > >> Disregarding any limitations of this code, do I > understand that > >> accept() spawns another socket with the file > handle of SESSION? > > > > If you're studying things

Re: Extreme beginner question on reading lines from a file.

2007-07-19 Thread Ryan
What is a lexical file handle? I'm working my way through Ford's "Perl Programming for the Absolute Beginner" (2007) and Lee's "Beginning Perl" (2004), and they both use the FH style of file handle. Should I do differently? Thanks. --Chris Chas Owens wrote: On 7/19/07, [EMAIL PROTECTED] <

Re: The role of listen()

2007-07-19 Thread Monty
That's the book I got the code snippet from. I hadn't found (yet) the explanation I'm looking for, but some testing has shown me that's what's happening. Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Extreme beginner question on reading lines from a file.

2007-07-19 Thread Chas Owens
On 7/19/07, John W. Krahn <[EMAIL PROTECTED]> wrote: Chas Owens wrote: > On 7/19/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> On Jul 18, 6:16 am, [EMAIL PROTECTED] (Ayesha) wrote: >> > >> > when I use while($line1 = ){ >> >$line = ; >> > } >> >

Re: Extreme beginner question on reading lines from a file.

2007-07-19 Thread John W. Krahn
Chas Owens wrote: On 7/19/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: On Jul 18, 6:16 am, [EMAIL PROTECTED] (Ayesha) wrote: > > when I use while($line1 = ){ >$line = ; > } while ($line=) { print"$line"; } 2. while ($line =

Re: The role of listen()

2007-07-19 Thread [EMAIL PROTECTED]
On Jul 18, 6:49 pm, [EMAIL PROTECTED] (Monty) wrote: > In studying network programming (and I'm just beginning at it), I see > where listen() is called to set up a socket that waits for incoming > connection requests. The next step appears to be a call to accept() > where the request is granted an

Re: The role of listen()

2007-07-19 Thread John W. Krahn
Peter Scott wrote: On Wed, 18 Jul 2007 17:49:52 +, Monty wrote: Disregarding any limitations of this code, do I understand that accept() spawns another socket with the file handle of SESSION? If you're studying things at this low level for academic purposes, I recommend Lincoln Stein's "Ne

Re: Need Help Installing Win32:SerialPort - ReVisited

2007-07-19 Thread Chas Owens
On 7/19/07, CM Analyst <[EMAIL PROTECTED]> wrote: Ok, I will sound like an idiot and at the moment, I feel like... Previously I was able to install and use the Win32:SerialPort module in my script on a WinXP PC. My requirement is now to run script on a Windows 2000 Workstation, so I downloaded

Re: Distill some string from whole string

2007-07-19 Thread yitzle
You can use substr() to get the string starting at 16 and going to 26... (did I count right?) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Distill some string from whole string

2007-07-19 Thread Chas Owens
On 7/19/07, jeanwelly <[EMAIL PROTECTED]> wrote: $my_string = "a\nbbl.dghd\n/usr/command\n"; I want to distill /usr/command and assign to a variable, how can I do? thanks! The smart ass in me wants to say my $my_string = "a\nbbl.dghd\n/usr/command\n"; my $substring = "/usr/command";

RE: Distill some string from whole string

2007-07-19 Thread Wagner, David --- Senior Programmer Analyst --- WGO
> -Original Message- > From: jeanwelly [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 19, 2007 05:26 > To: beginners@perl.org > Subject: Distill some string from whole string > > $my_string = "a\nbbl.dghd\n/usr/command\n"; > > I want to distill /usr/command and assign to a variable

Distill some string from whole string

2007-07-19 Thread jeanwelly
$my_string = "a\nbbl.dghd\n/usr/command\n"; I want to distill /usr/command and assign to a variable, how can I do? thanks! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Need Help Installing Win32:SerialPort - ReVisited

2007-07-19 Thread CM Analyst
Ok, I will sound like an idiot and at the moment, I feel like... Previously I was able to install and use the Win32:SerialPort module in my script on a WinXP PC. My requirement is now to run script on a Windows 2000 Workstation, so I downloaded and installed Perl 5 and the said module using "ppm

Re: Extreme beginner question on reading lines from a file.

2007-07-19 Thread Chas Owens
On 7/19/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: On Jul 18, 6:16 am, [EMAIL PROTECTED] (Ayesha) wrote: > Hi all > > I got started on Perl only today! > I have a text file in which I need to read a line and the line after > that. Like > > line1 and line2 > line2 and line3 > line3 and line4

Re: Multiple file perl program

2007-07-19 Thread Chas Owens
On 7/19/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: How do I write a multiple file perl program? I dont want to conflict with any real module names that were built in or are on CPAN. I just want to spread some subs onto some other files. The easiest way to avoid namespace conflict is to i

Multiple file perl program

2007-07-19 Thread horizxon
How do I write a multiple file perl program? I dont want to conflict with any real module names that were built in or are on CPAN. I just want to spread some subs onto some other files. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.

Re: Extreme beginner question on reading lines from a file.

2007-07-19 Thread [EMAIL PROTECTED]
On Jul 18, 6:16 am, [EMAIL PROTECTED] (Ayesha) wrote: > Hi all > > I got started on Perl only today! > I have a text file in which I need to read a line and the line after > that. Like > > line1 and line2 > line2 and line3 > line3 and line4 > > when I use while($line1 = ){ >

Re: Query

2007-07-19 Thread kapil.V
John W. Krahn wrote: kapil.V wrote: Hi, Hello, su-2.05b# df -h . Filesystem Size Used Avail Capacity Mounted on /dev/ad0s1e 136G 102G 23G 82% /home From my script I do: my $du = qx#df -h \.#; ($total,$used) = $du =~ /([0-9]+(\.[ 0-9]+)?)[ M|G]/sg;

Re: homework

2007-07-19 Thread Chas Owens
On 7/19/07, Amichai Teumim <[EMAIL PROTECTED]> wrote: Hi This is my homework: This really isn't a forum for people's homework. "Write a script called *obj13-1.pl* and a library called *obj13-lib.pl*. The library should contain a function that takes in an array of numbers (of arbitrary size)

homework

2007-07-19 Thread Amichai Teumim
Hi This is my homework: "Write a script called *obj13-1.pl* and a library called *obj13-lib.pl*. The library should contain a function that takes in an array of numbers (of arbitrary size). The function will then calculate the average of the numbers, the total of all of the numbers added togethe

Re: heredoc issure

2007-07-19 Thread Rob Dixon
[EMAIL PROTECTED] wrote: lnatz wrote: Hi, I'm having an issue with here docs, and I'm sure it's something simple that I'm overlooking but it's annoying me. Here is a snippet from my script. sub usageAndDie { print< < EOF; >> The following single-character otions are accepted: >> wih argument

Re: The role of listen()

2007-07-19 Thread Jeff Pang
--- Peter Scott <[EMAIL PROTECTED]> wrote: > On Wed, 18 Jul 2007 17:49:52 +, Monty wrote: > > Disregarding any limitations of this code, do I > understand that > > accept() spawns another socket with the file > handle of SESSION? > > If you're studying things at this low level for > academic

RE: heredoc issure

2007-07-19 Thread christopher . l . hood
I think that Rob was onto something, here is my 2 cents.   The print line should be like this:    print <   and not   print< < EOF   like you have.  I think maybe that what is happening is that the error that is being printed is saying that it cannot find “EOF” before end of file

Re: The role of listen()

2007-07-19 Thread Peter Scott
On Wed, 18 Jul 2007 17:49:52 +, Monty wrote: > Disregarding any limitations of this code, do I understand that > accept() spawns another socket with the file handle of SESSION? If you're studying things at this low level for academic purposes, I recommend Lincoln Stein's "Network Programming W

Re: Query

2007-07-19 Thread Paul Lalli
On Jul 18, 6:43 am, [EMAIL PROTECTED] (kapil.V) wrote: > su-2.05b# df -h . > Filesystem Size Used Avail Capacity Mounted on > /dev/ad0s1e 136G 102G 23G 82% /home > > From my script I do: > my $du = qx#df -h \.#; > ($total,$used) = $du =~ /([0-9]+(\.[ 0-9]+)

Re: Optimize my script

2007-07-19 Thread JeeBee
Thanks very much. It runs a LOT faster now. Like 20 times or maybe even a bit more. I'm now trying to verify that the result is still the same, but I believe so. So, thanks very much :) JeeBee. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http

Re: Q: cannot use base while Exporting ?

2007-07-19 Thread Paul Lalli
On Jul 18, 1:20 am, [EMAIL PROTECTED] (Jack Minoshima) wrote: > Hi. > Please allow me to ask another silly question. > > I wrote the program and it works fine. > > > Animal.pm > package Animal; > use Exporter; > @ISA = qw(Exporter

Re: Optimize my script

2007-07-19 Thread JeeBee
>> >> my $exp = "nan|-?inf|[0-9\.e\+\-]+"; >> my $stat_pat = >>"(?:\\s+($exp))(?:\\s+($exp))" . # $1 number of samples, $2 minimum >>"(?:\\s+($exp))(?:\\s+($exp))" . # $3 maximum, $4 sum >>"(?:\\s+($exp))(?:\\s+($exp))" . # $5 average, $6 variance >>"(?:\\s+($exp))(?:\\s+($exp))";

Re: Convert Scientific Notation to decimal equivalent

2007-07-19 Thread Xavier Noria
El Jul 19, 2007, a las 12:19 AM, Joseph L. Casale escribió: Interesting, I see from your regexp you use a \A and \z, from Perldoc this means: \A Match only at beginning of string \z Match only at end of string I am not sure I understand this requirement? ^ and $ depend on flags, and