RE: Good examples of POD for newbies?

2004-12-09 Thread Shaw, Matthew
perldoc perlpod is pretty comprehensive. Have you checked that out? -Original Message- From: KEVIN ZEMBOWER [mailto:[EMAIL PROTECTED] Sent: Thursday, December 09, 2004 10:18 AM To: [EMAIL PROTECTED] Subject: Good examples of POD for newbies? Can anyone suggest a small module which demons

RE: Pattern Matching

2003-11-19 Thread Shaw, Matthew
> Hi, I'm trying to find out how many newline characters are in > a string. I thought there would be a simple function for > this, but I can't find it; Do I need to step through the > string a character at a time to check this? I have used this: #!/usr/bin/perl use warnings; use strict; my $

RE: Beta Testing a Robot

2003-12-04 Thread Shaw, Matthew
My $0.02 on this: While it may be a worthwhile personal pursuit to write a script that provides relevant results from google based on the text of someone's email/news posting/etc, I don't think this is the forum for it. These are very busy lists to start with and this essentially will result in do

RE: removing duplicate array values

2004-04-21 Thread Shaw, Matthew
Hi Darren, -Original Message- > I'd like to remove duplicate values from an array to leave it with only > unique values. For instance, if an array contains (1,2,3,1,4,2,5) as > values, I'd like to clean out the extra 1 and 2 to leave the values as > (1,2,3,4,5). Does perl have an array c

RE: Line number variable....

2004-05-07 Thread Shaw, Matthew
> -Original Message- > >there a variable containing the actual > > source-line number during execution? > > > > Yes, the $. This is incorrect, $. actually contains the 'current line number' from the last accessed file handle. It will be undef if no filehandles have been accessed. The _

RE: Foo (Bar)

2004-09-08 Thread Shaw, Matthew
Jason: Foo & bar (or just foobar) are terms of varied origins simply meant to express 'this thing' as in 'in function foo what will the output be given argument bar'. (Compare also to: x (y)) There are many explanations for the origin of the term, and most are captured at one of the two following

RE: Reading Multiple Lines

2004-09-08 Thread Shaw, Matthew
Eduardo: Depending on how many lines you need to work with at once and how disparate they are, you could create a buffer of the last N lines to work on, such as: while ( ) { push @buffer, $_; shift @buffer if @buffer > 10; # @buffer will now have the current

RE: String to Numeric of an Array

2004-09-14 Thread Shaw, Matthew
Edward: What you have there is an array with only one scalar element (an array reference containing 3 values). Note that $array[1] & $array[2] would be undefined in your example. I think what you intended was to do: @array = ('1','2','3'); # An array containing three elements, '1', '2', '3' (Or m

RE: Measure program performance

2004-09-28 Thread Shaw, Matthew
> I need measure how much my perl program consume while it is executed. You can use the Benchmark module to determine execution times. This is included in the core module set. There is also a related FAQ page that you can read by doing: perldoc -q profile at your command prompt. There is also

RE: How to accumulate Hashes of Array value with the same key?

2004-09-30 Thread Shaw, Matthew
> I have thre HoAs with the same key but different value. > How can I efficiently join the HoA: > > my %HoA = (key1 => ['A',1]); > my %HoA2 = (key1 => ['B',2]); > my %HoA3 = (key1 => ['C',2]); > > into: > > %HoA = (key1 => ['A',1],['B',2],['C',2]); > push @{$HoA{key1}}, ( @{$HoA2{key1}}, @{$Ho

RE: How to accumulate Hashes of Array value with the same key?

2004-09-30 Thread Shaw, Matthew
> > I have thre HoAs with the same key but different value. > > How can I efficiently join the HoA: > > > > my %HoA = (key1 => ['A',1]); > > my %HoA2 = (key1 => ['B',2]); > > my %HoA3 = (key1 => ['C',2]); > > > > into: > > > > %HoA = (key1 => ['A',1],['B',2],['C',2]); > > > > push @{$HoA{key1}},

RE: Why are file handles wierd?

2004-10-18 Thread Shaw, Matthew
No one has mentioned (I think) that filehandles are actually 'typeglobs' yet so I thought I'd chime in on this. They also actually do have an associated sigil: '*'. There's plenty of explanation on filehandles in typeglobs in the following documents: perldoc perldata (Heading: 'Typeglobs and File

RE: Append on top

2004-11-15 Thread Shaw, Matthew
> Rajesh Dorairajan wrote: > > Does anyone know of a way to open a file in append mode and append on top of > > I don't know why people are having a problem with this sollution, simply > open in append mode so open doesn't clobber the file, then use seek() to > move to the beginning of the file.