[26479] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8641 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 7 18:05:26 2005

Date: Mon, 7 Nov 2005 15:05:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 7 Nov 2005     Volume: 10 Number: 8641

Today's topics:
        from text file to array in shortest way <ngoc@yahoo.com>
    Re: from text file to array in shortest way <no@email.com>
    Re: threads in perl <nobody@this.home.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 07 Nov 2005 23:40:56 +0100
From: ngoc <ngoc@yahoo.com>
Subject: from text file to array in shortest way
Message-Id: <436fc98d$1@news.broadpark.no>

my @books_array = ();
open(FILE, '<books_file.txt') or croak 'Can open file';
while (<FILE>){
     push @books_array, $_;
}
Other shorter ways than above?


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

Date: Mon, 07 Nov 2005 21:49:34 +0000
From: Brian Wakem <no@email.com>
Subject: Re: from text file to array in shortest way
Message-Id: <3ta0feFrmqboU1@individual.net>

ngoc wrote:

> my @books_array = ();
> open(FILE, '<books_file.txt') or croak 'Can open file';
> while (<FILE>){
>      push @books_array, $_;
> }
> Other shorter ways than above?

open......
my @books_array = <FILE>;


-- 
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png


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

Date: Mon, 07 Nov 2005 18:35:41 +0100
From: Krystian <nobody@this.home.com>
Subject: Re: threads in perl
Message-Id: <u24vm1d7n9smf21t5pee0k19ko9n2gu3j2@4ax.com>

thanks for help
best
k

>If you want to use shared variables, you must declare it as shared.
>Watch out for Threads vs. threads capitalization errors.
>
>#!/usr/bin/perl
>use threads;
>use threads::shared;
>
>my $foo : shared = 1;
>my $bar = 1;
>
>my $thr1=threads->new(sub { $foo++; $bar++ })->join;
>my $thr2=threads->new(sub { $foo++; $bar++ })->join;
>
>print "$foo\n";  #prints 3 since $foo is shared 
>print "$bar\n";  #prints 1 since $bar is not shared 



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 8641
***************************************


home help back first fref pref prev next nref lref last post