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
> 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 $
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
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
> -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 _
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
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
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
> 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
> 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
> > 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}},
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
> 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.
13 matches
Mail list logo