>
> %seen = ( );
> $string = "an apple a day";
> foreach $char (split //, $string) {
> $seen{$char}++;
> }
> print "unique chars are: ", sort(keys %seen), "\n";
>
> Also, a couple of paragraphs later, the Cookbook goes on to show how
> to solve the same problem with a while loop a
On Tue, 26 Oct 2004 16:50:11 -0400, Bob Showalter
<[EMAIL PROTECTED]> wrote:
> rs wrote:
> > Hi,
> > Here's a snippet of some code from the cookbook.
>
> Hmm, time to get a new cookbook :~)
Nope. Just make sure you understand the the OP changed the code
quoted from the cookbook, and that the c
On Thu, 14 Oct 2004 16:11:42 -0600, Michael Robeson <[EMAIL PROTECTED]> wrote:
> Yeah, I have just submitted that same question verbatim to the bio-perl
> list. I am still running through some ideas though. I have both
> Bioinformatics perl books. They are not very effective teaching books.
>
> Th
On Thu, 14 Oct 2004 23:23:48 +0200, Paul Johnson <[EMAIL PROTECTED]> wrote:
> On Thu, Oct 14, 2004 at 11:02:06AM -0600, Michael Robeson wrote:
>
> > I have a set of data that looks something like the following:
>
> > So, my problem is that I think I know some of the bits of code to put
> > into p
On Thu, 14 Oct 2004 16:08:44 -0400, Willy West <[EMAIL PROTECTED]> wrote:
> On Thu, 14 Oct 2004 14:47:57 -0500, Errin Larsen <[EMAIL PROTECTED]> wrote:
> >
>
> > > bio-informatics is a big area in which Perl is involved... there's even
> > > a book
On Thu, 14 Oct 2004 15:40:24 -0400, Willy West <[EMAIL PROTECTED]> wrote:
> > PS: is this a common problem/exercise in some class somewhere? I keep
> > seeing requests for help having to do with those exact strings of DNA
> > data. Is there a bunch of people working on DNA projects using Perl
> >
On Thu, 14 Oct 2004 11:02:06 -0600, Michael Robeson <[EMAIL PROTECTED]> wrote:
> I have a set of data that looks something like the following:
>
<>
>
> So, any suggestions would be greatly appreciated. If anyone can help me
> out with all or even just bits of this I would greatly appreciate it.
I figured it out. I thought I'd post what I found.
> I've cobbled some code together to test stuff out with:
>
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
> my @addresses;
> my @message;
>
> if( @ARGV ) {
> print "There are arguments\n";
> while( $ARGV[0] =~ /[EMAIL PR
On Tue, 12 Oct 2004 09:26:12 -0600, Wiggins d Anconia
<[EMAIL PROTECTED]> wrote:
> > Hi Perl Mongers,
> >
> > I'm trying to parse some command line options.
> >
<>
> >
>
> So in this case you have two arguments in @ARGV and waiting text on
> STDIN? Is it this last part that is confusing you.
>
Hi Perl Mongers,
I'm trying to parse some command line options.
I'm expecting either no arguments, email addresses or email addresses
and file names/piped input. This script will take the email addresses
and send the contents of a file to them, or the output of a piped
command. So, I would expe
On Fri, 8 Oct 2004 15:25:36 -0700 (PDT), Ron Smith
<[EMAIL PROTECTED]> wrote:
>
>
> Thanks all. The problem was at the begining of the 'TELNET' session, I have
> to type in: UNSET CRLF.
>
>
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We fi
-- Forwarded message --
From: Errin Larsen <[EMAIL PROTECTED]>
Date: Fri, 8 Oct 2004 15:36:28 -0500
Subject: Re: Extra newline characters.
To: Ron Smith <[EMAIL PROTECTED]>
On Fri, 8 Oct 2004 13:24:22 -0700 (PDT), Ron Smith
<[EMAIL PROTECTED]> wrote:
<&g
#x27;sdf.lonestar.org'. The first thing that appears at login is the following:
>
> NetBSD/alpha (sdf) (ttypu)
>
> Does that help?
>
> Ron
>
>
>
>
> Errin Larsen <[EMAIL PROTECTED]> wrote:
>
>
> On Fri, 8 Oct 2004 11:11:26
On Fri, 8 Oct 2004 11:11:26 -0700 (PDT), Ron Smith
<[EMAIL PROTECTED]> wrote:
> I'm working the exercises out of the "Learning Perl" book, but I'm doing so through
> a shell account from a Window$ box into a UNIX environment. I'm experiencing an
> oddity wherein I'm getting, what I think are, ext
On Thu, 7 Oct 2004 15:52:14 -0400 (EDT), Chris Devers <[EMAIL PROTECTED]> wrote:
> On Thu, 7 Oct 2004, Adam Saeed wrote:
>
> > I want to built a opensource utility for telemarketers.
>
> Ahh, I see.
>
> Well, I'm fresh out of ideas in that case.
>
> Good luck, and let us know how it goes! :-)
>
Hi Perl Mongers,
I need to configure the CPAN module to use gcc (which I've installed).
Whenever I run:
# perl -MCPAN -e 'install Bundle::CPAN;'
the CPAN module automatically uses the cc that is in my /usr/ucb/
directory. (I'm running Solaris 9 on Sun hardware). I tried adding
the following li
On Tue, 5 Oct 2004 14:32:27 -0400, Willy Perez <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Is there a method to pass a shell assigned variable to perl?
>
> For ex:
>
> ABC=xyc
>
> perl -ne 'print $ABC'
>
> In awk you could use ENVIRON["varname"], is there something
> compatible in perl.
>
>
> Wi
On Mon, 4 Oct 2004 18:33:51 -0300, Sprogis, Rubens (V-Emeritis)
<[EMAIL PROTECTED]> wrote:
> How can I do to concatenate 2 strings?
>
>
Hi!
Glad you are trying Perl! Welcome to the group!
Let me offer you some advice. This mailing list works best when you
write some of your own code, try it,
On Fri, 1 Oct 2004 17:41:50 +0200, Jan Eden <[EMAIL PROTECTED]> wrote:
> Hi,
Hello!
<>
>
> How can I pass an option to system's first argument in a setting like this?
>
> (I know I can use a module instead of calling wget, but this is a more general
> issue.)
>
> Thanks,
>
> Jan
> --
Th
On Thu, 30 Sep 2004 23:30:16 +0200, Gunnar Hjalmarsson
<[EMAIL PROTECTED]> wrote:
>
> Nothing prevents you from declaring @FILE_NAME:
>
> package Config;
> our @FILE_NAME;
> do "configtest.conf";
> print "$_\n" for @FILE_NAME;
>
> --
> Gunnar Hjalmarsson
> Email: http://www.g
On 30 Sep 2004 19:52:31 -, PerlDiscuss - Perl Newsgroups and
mailing lists <[EMAIL PROTECTED]> wrote:
> I am using Cygwin on Win2K and the version of perl on it is
> v5.8.0
>
> I am using the same input file, but when I run the command you ran, the
> output looks like
>
> Object1 Description
Hi Perlers,
I'm trying to implement one of the recipes I found in the Perl
Cookbook. It is "8.16. Reading Configuration Files" recipe. Here are
some snippets from that text:
" ... Or better yet, treat the config file as full Perl code:
do "$ENV{HOME}/.progrc";
...
The second solution uses do
I am (admitedly) unfamiliar with OO Perl. I understand enough to grok
what you are saying, Wiggins, but I have a question.
Does a sub (like the one above) have a problem with being called with
& as opposed to not being called with an & with OO Perl? That
questions was worded weird. Let me try a
> Thanks for your help guys...
>
> But the code is performing the logic only for the first set of lines...
>
> After the running the above script, the output looks like
>
> Object1<...tab...>Description1
>
> Object2
> Description2
>
> Object3
> Description3
Can you post EXACTLY what's in the
On Fri, 1 Oct 2004 01:37:44 +0930, Sano Babu <[EMAIL PROTECTED]> wrote:
> just wondering what a user of Perl may be called? "Perler"?? Theres
> got to be some fancy name for it. Perl is not just another programming
> language.. I reckon its much more like a religion with attitude.. :)
>
> Cheers,
Hi Paul,
Thx for the response
On Thu, 30 Sep 2004 15:30:06 +0200, Paul Johnson <[EMAIL PROTECTED]> wrote:
<>
>
> Pretty close:
>
> $ perl -MO=Deparse -l00pe's/\n/\t/;s/\"//g'
> BEGIN { $/ = "\n"; $\ = "\000"; }
> LINE: while (defined($_ = )) {
> chomp $_;
> s/\n/\t/;
> s/"//g;
> }
Hi Perlers,
On 30 Sep 2004 10:11:29 +0100, Jose Alves de Castro
<[EMAIL PROTECTED]> wrote:
> On Wed, 2004-09-29 at 21:25, JupiterHost.Net wrote:
> > >>> I would like the output in the following format
> > >>> object1<...tab>Description1
> > >>> object2<...tab>Description2
> > >>> object3<.
On Wed, 29 Sep 2004 12:27:03 -0400, Bob Showalter
<[EMAIL PROTECTED]> wrote:
> Errin Larsen wrote:
> > When I use the following in my code, it runs and
> > works fine:
> >
> > use POSIX 'setsid';
> > use POSIX 'errno_h';
> >
On Wed, 29 Sep 2004 11:32:58 -0400, Jim <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi Perlers,
> >
> > I've seen a lot of tutorial or example code dealing with the
> > POSIX module that does something like this:
> >
> > use POSIX ':sys_wait_h';
> >
> > What does the ':' mean/do in the above line?
>
Hi Perlers,
I've seen a lot of tutorial or example code dealing with the POSIX
module that does something like this:
use POSIX ':sys_wait_h';
What does the ':' mean/do in the above line?
--Errin
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Wed, 29 Sep 2004 22:18:49 +0800, Edward Wijaya
<[EMAIL PROTECTED]> wrote:
> On 29 Sep 2004 14:58:00 +0100, Jose Alves de Castro
> <[EMAIL PROTECTED]> wrote:
> > If I understood this correctly, you want to do this:
> >
>
> So sorry for being not clear.
> I will extend just a bit.
>
> Suppose I
Hi Urs,
You should look at Cwd:
perldoc Cwd
That capital "C" in "Cwd" is relevant.
--Errin
On Wed, 29 Sep 2004 15:24:06 +0200, Urs Wagner <[EMAIL PROTECTED]> wrote:
> Hello
>
> How can I find out the current directory? I call chdir, afterwards I
> should switch back to the old one.
>
> Th
On Wed, 29 Sep 2004 07:52:53 -0400, Meidling, Keith, CTR, ISD
<[EMAIL PROTECTED]> wrote:
> UNCLASSIFIED
>
> Is there a module to get a list of processes on a UNIX/Linux machine, or
> would I just do a `ps` and save it to an array?
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional
On Tue, 28 Sep 2004 15:26:08 -0400 (EDT), Chris Devers
<[EMAIL PROTECTED]> wrote:
> On Tue, 28 Sep 2004, Errin Larsen wrote:
>
> > On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya
> > <[EMAIL PROTECTED]> wrote:
> >
> > > use vars qw($f);
>
Hi Edward,
On Tue, 28 Sep 2004 11:20:39 -0400, Bob Showalter
<[EMAIL PROTECTED]> wrote:
> Edward Wijaya wrote:
> > Thanks a lot for your reply Bob.
> > but can you be more specific:
> >
> > > You need to either close and reopen the file, or
> > > rewind the file using seek() before you can re-rea
Hi again, Edward!
Just so you know, you should CC the list when you reply!
On Tue, 28 Sep 2004 22:26:55 +0800, Edward Wijaya
<[EMAIL PROTECTED]> wrote:
> Thanks Errin,
> It works just as you suggested.
> Thanks so much for your thorough
> explanation. Glad that I learnt much from it.
>
> >
> >
Hi Edward!
On Tue, 28 Sep 2004 18:51:12 +0800, Edward Wijaya
<[EMAIL PROTECTED]> wrote:
> Hi,
> Why my code below fail to open and
> print the file contents
>
> when I do:
>
> perl mycode.pl -f filename
>
> Regards,
> Edward WIJAYA
> SINGAPORE
>
> __BEGIN__
> use strict;
> use warnings;
Go
ies some
inner-geek need I have!
>
> On Fri, 24 Sep 2004 10:34:50 -0500, Errin Larsen <[EMAIL PROTECTED]>
> wrote:
> > On Fri, 24 Sep 2004 17:20:44 +0200, Jenda Krynicky <[EMAIL PROTECTED]>
> wrote:
> > > From: Errin Larsen <[EMAIL PROTECTED]>
>
On Fri, 24 Sep 2004 10:34:50 -0500, Errin Larsen <[EMAIL PROTECTED]> wrote:
> On Fri, 24 Sep 2004 17:20:44 +0200, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> > From: Errin Larsen <[EMAIL PROTECTED]>
<>
>
> how do I wait() or waitpid() on more than one p
On Fri, 24 Sep 2004 17:20:44 +0200, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> From: Errin Larsen <[EMAIL PROTECTED]>
> > See that ""?! How did my process get a status? Is
> > that a Solaris-fancy way of saying "zombie-child"?
>
> I bel
Ok, I learned something else ...
When I type:
kill -9
on the command line, It's not actually killing the process.
Let me explain. My script starts 3 others and then stays around
watching them. So, when I run it, I get this:
# ps -ef | grep dummy
user1 18000 1 0 10:04:22 ?0:00 dummy_mon
On Fri, 24 Sep 2004 10:31:36 -0400, Ed Christian <[EMAIL PROTECTED]> wrote:
> Errin Larsen wrote:
> > Hi Perlers,
> >
>
>
>
> >
> > if( kill 0 => $pid ) {
> >
>
>
>
> Forgive me if I presume too much, but shouldn't the a
On Fri, 24 Sep 2004 09:17:58 -0500, Errin Larsen <[EMAIL PROTECTED]> wrote:
> Hi Perlers,
>
> I'm trying to check on the status of a process by sending a SIGZERO to
> it with kill(). This SHOULD (according to the docs I've been reading)
> return false if the proc
Hi Perlers,
I'm trying to check on the status of a process by sending a SIGZERO to
it with kill(). This SHOULD (according to the docs I've been reading)
return false if the process died. But mine is not. It always returns
true.
if( kill 0 => $pid ) {
print "the process is OK\n";
} else {
-- Forwarded message --
From: Errin Larsen <[EMAIL PROTECTED]>
Date: Thu, 23 Sep 2004 16:30:21 -0500
Subject: Re: Daemon that starts other Daemons
To: Wiggins d Anconia <[EMAIL PROTECTED]>
Hi again,
Ok ... so with some research and playi^H^H^H^H^Htesting I've fo
On Thu, 23 Sep 2004 11:23:16 -0500, Errin Larsen <[EMAIL PROTECTED]> wrote:
> Hi perl-people,
<>
> So, my question is, how do I implement this code WITHOUT the parent
> process dieing?
>
> --Errin
>
I found that (at least on the Solaris OS that I'm workin
Hi perl-people,
I'm not sure if this is beginners stuff, but I'll post here 'cause
it's the only list I'm subscribed to at the moment.
I'm writing a script that will daemonize itself, and then watch some
processes. If one of those processes die, it will start it again.
So, I've been reading the
Hi Perlers,
I know that questions like this get asked all the time, but I guess
it's just my turn to ask 'em!
I need to kick of some processes in my script. However, the script
needs to kick them all off at once and then stick around to do some
other things. I'm kinda new to Perl, but in my OS'
On Tue, 21 Sep 2004 14:58:43 -0400 (EDT), Jeff 'japhy' Pinyan
<[EMAIL PROTECTED]> wrote:
> On Sep 21, Bob Showalter said:
>
> > my %hash = (
> > foo => 1,
> > bar => 2,
> > baz => 3,
> > qux => 4,
> > );
> >
> >I would like to remove all the entries in the hash except for '
On 21 Sep 2004 13:03:21 -, Peter Scott <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] (Jp) writes:
> >The object of the code below is to output a list of space seperated fields
> >with PID, username and process. The code generates te correct output. My
> >gues
> Because the push() statement is in a loop, and my() would empty
> the variable at each iteration.
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl
Hi Gunnar ... Thanks for the help.
I assure the list, the following is the code EXACTLY as I was using it to test:
#!/u
Hi all, straight out of the Learning Perl book (3rd edition, page 275)
is this code:
my @numbers;
push @numbers, split while <>;
foreach (sort { $a <=> $b } @numbers) {
printf "%20g\n", $_;
}
This works flawlessly. My question is why can't I put that variable
declaration in the push function?
I forgot to CC the list with my last post! sorry, won't happen again.
--Errin
-- Forwarded message --
From: Errin Larsen <[EMAIL PROTECTED]>
Date: Fri, 10 Sep 2004 15:46:33 -0500
Subject: Re: How to dynamically taking the multiple input arguments?
To: Bee <[E
On Fri, 10 Sep 2004 15:01:34 -0400, David Greenberg
<[EMAIL PROTECTED]> wrote:
> Opps, I missed that. Instead of:
> @results = map { my $line = $_; chomp $line; $line =~ s/\s+//g; $line } (@data);
> try:
> my @newresults = map { my $line = $_; chomp $line; $line =~ s/\s+//g;
> shift (@results) . $
On Sat, 11 Sep 2004 02:20:32 +0800, Bee <[EMAIL PROTECTED]> wrote:
>
>
> > >foreach( @ARGV ) {
> > > open IN, $_ or die "Couldn't open $_: $!\n";
> > > chomp( my @data = );
> > > close IN;
> > > foreach( @data ) { s/\s+//g; }
> > > foreach( 0..$#data ) { $results[$_
On Fri, 10 Sep 2004 13:17:40 -0400, David Greenberg
<[EMAIL PROTECTED]> wrote:
> I'm no expert, but chomp won't give you what you think it will:
> my @arr = ('a', "b\n", "c\n");
> print join (",",chomp (@arr));
>
> This will print:
> 2
>
> while this:
> my @arr = ('a', "b\n", "c\n");
> chomp (@ar
On Fri, 10 Sep 2004 12:44:51 -0400, David Greenberg
<[EMAIL PROTECTED]> wrote:
> >foreach( @ARGV ) {
> > open IN, $_ or die "Couldn't open $_: $!\n";
> > chomp( my @data = );
> > close IN;
> > foreach( @data ) { s/\s+//g; }
> > foreach( 0..$#data ) { $results[$_] .= $
Here ya go ... this works for me. I tested it with up to 5 input
files and it was still workin'. It does have a bug, though. It
doesn't check whether all the input files are the same length. Nor
did I test what happens when they AREN'T the same length. Let me know
what ya think:
#!/usr/bin/pe
Well, I'm kinda new at this stuff myself, but Here's a couple of
things I see right away:
On Sat, 11 Sep 2004 10:27:44 +0800, Edward WIJAYA
<[EMAIL PROTECTED]> wrote:
> Hi,
<>
> #!/usr/bin/perl -w
--You don't really need to use the -w flag here AND the 'use
warnings' in your subroutine
d
On Fri, 10 Sep 2004 09:09:43 -0500, Errin Larsen <[EMAIL PROTECTED]> wrote:
> Ok ... in the spirit of universal Perl-ing,
<>
Oops ... I didn't realize he re-posted to the list in English ...
Never Mind!
--Errin
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additio
Ok ... in the spirit of universal Perl-ing, I'll try to translate the
below for the rest of us on the list! I put my notes that are in the
code inside "--( )--" marks. I'm not really good at this sort of
thing, but with the help of some "Google-ing" and what not, here goes
...
On Fri, 10 Sep 20
1-9]/
But If I find it, how do I strip it off?
--Errin
On Thu, 9 Sep 2004 19:39:34 +0530, Sid <[EMAIL PROTECTED]> wrote:
> Use the following:
>
> $option = "0" . $option if ($option / 10 < 1 && $option !~ /^0/);
>
> ~Sid
>
>
>
> On Thu,
Hi All,
I have a variable I'm reading off of the command line:
my $option = shift;
That variable should hold a number between 1 and 31 (yes, a day of the
month) I am checking to make sure that the number does indeed lie in
that range.
However, I need to pass that variable to another system com
the above to a
variable:
my $regex = shift;
How do I use the regex in $regex in a m// oeration?
Do I just throw it in there?
/$regex/
That seems to work, but is it doing what I think it's doing? I may be
over-thinking myself here, but it just seems too easy!
--Errin Larsen
--
To unsubsc
Hi guys (and gals!),
I want to compare a constant, known (expected values) array with the
results I'm collecting in another array.
Something like this, but I don't think this works the way I want it to:
my @rray1 = qw( One Two Three );
chomp( my @rray2 = );
print "The 2 arrays are the same\n"
On Tue, 31 Aug 2004 14:07:14 -0400 (EDT), Chris Devers
<[EMAIL PROTECTED]> wrote:
> On Tue, 31 Aug 2004, Errin Larsen wrote:
>
> > I am collecting temperature data from the CPUs in my system.
<>
> This is nitpicking, but have you considered inverting that? A format
Hi Perl Gurus!
I am collecting temperature data from the CPUs in my system. I want
to write this data into a comma-seperated text file, like so:
CPU1,65,63,62,64
CPU2,65,64,64,62
CPU3,64,65,66,64
Each line represents one CPU's temperature readings. Each column
represents the time the reading w
Perl and
XML resources. Jonathan is also a co-author of an upcoming book from
O'Reilly and Associates covering Perl and XML.
On Tue, 24 Aug 2004 15:59:57 -0500, Errin Larsen <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Can you help me understand the below a little better.
>
> As I
Hey,
Ok, looking through this ... I'm confused.
<< SNIP >>
> >
> > Perhaps:
> >
> >$scalar =~ s/^(a|an|the)\s*\b//i;
> >
> > would work better.
<>
Is this capturing into $1 the a|an|the (yes) and the rest of the title
into $2 (no?). After doing so, will it reverse the two ( i.e.
s/^(a|a
Hi,
Can you help me understand the below a little better.
As I understand what's going on, the Process (let's say PID=100)
spawns a child with the fork() function (let's say PID=200). This
(200) is assigned to $pid in the parent, and zero (0) is assigned to
$pid in the child. So, what does "my
hat I would like to know how
to do!
Thx!
--Errin
On 13 Aug 2004 16:57:00 +0100, Jose Alves de Castro <[EMAIL PROTECTED]> wrote:
> On Fri, 2004-08-13 at 16:51, Errin Larsen wrote:
> > um, can anyone explain the 'print' function below to me?
> >
> > specific
um, can anyone explain the 'print' function below to me?
specifically ... this:
'print "@F[0,5]"'
How do I use this idea in a script instead of a command line? also,
how is the input getting into this function? I mean, I understand $_
and all, but on a command line, are we piping to that com
Thx ... That is exactly what I was looking for!
I was really only missing the '..' part.
Thanks again!
--Errin
On Fri, 13 Aug 2004 06:46:08 -0700, John W. Krahn <[EMAIL PROTECTED]> wrote:
> Errin Larsen wrote:
> > Hey guys (and gals, I imagine!),
>
> Hello,
>
64 OK
CPU3 63 OK
MB 35 OK
IOB 30 OK
DBP0 32 OK
=
<>
What I'm looking for is a graceful way to do this in a perl script.
I'm kinda at a
74 matches
Mail list logo