D wrote:
I ran into something that I need help understanding. In the attached
script, subroutine file_proc1 converts all elements of @molec to
undef, while file_proc2 does not. adjusting file_proc1 to first slurp
the file into an array "fixes it". My best guess (via dum_sub) is
that the subrou
This is no surprise, regexp is a relatively heavy function, a lot of dirty
work behind the scene.
On Thu, Apr 16, 2009 at 2:13 PM, John W. Krahn wrote:
> Emen Zhao wrote:
>
>> This is off topic. But I'm just curious about why "4096" is picked here.
>> Is
>> there any particular reason behind it?
Thank you, Chas! This is great to know. I guess I got used to taking a
plethora of memory as granted. :-)
--Emen
Emen Zhao wrote:
This is off topic. But I'm just curious about why "4096" is picked here. Is
there any particular reason behind it? I guess you can even calc the lines
like this -
perl -0777 -wne 'print scalar ($_=~s/\n//g)' filename
Except that it's slower than using tr///:
$ time perl -ln077
On Thu, Apr 16, 2009 at 00:58, Emen Zhao wrote:
> This is off topic. But I'm just curious about why "4096" is picked here. Is
> there any particular reason behind it? I guess you can even calc the lines
> like this -
> perl -0777 -wne 'print scalar ($_=~s/\n//g)' filename
>
> Thanks,
> Emen
>
409
This is off topic. But I'm just curious about why "4096" is picked here. Is
there any particular reason behind it? I guess you can even calc the lines
like this -
perl -0777 -wne 'print scalar ($_=~s/\n//g)' filename
Thanks,
Emen
On 15 Apr 2009, at 13:01, John W. Krahn wrote:
Dermot wrote:
2009/4/14 Chas. Owens :
On Tue, Apr 14, 2009 at 11:49, Rick wrote:
is it true that perl will be just as fast as c for reading files ?
for example
cow...@amans:~$ time cat /usr/share/dict/words | perl wc.pl
my $count = 0;
$/ =
Dermot wrote:
2009/4/14 Chas. Owens :
On Tue, Apr 14, 2009 at 11:49, Rick wrote:
is it true that perl will be just as fast as c for reading files ?
for example
cow...@amans:~$ time cat /usr/share/dict/words | perl wc.pl
my $count = 0;
$/ = \4096;
while (<>) {
$count += tr/\n//;
2009/4/14 Chas. Owens :
> On Tue, Apr 14, 2009 at 11:49, Rick wrote:
>> is it true that perl will be just as fast as c for reading files ?
>>
>> for example
>>
> cow...@amans:~$ time cat /usr/share/dict/words | perl wc.pl
> my $count = 0;
>
> $/ = \4096;
> while (<>) {
> $count += tr/\n//
On Tue, Apr 14, 2009 at 11:49, Rick wrote:
> is it true that perl will be just as fast as c for reading files ?
>
> for example
>
> will below be as fast as if it were written in c?
> I said this because on random posts, I see that perl is optimized to work w/
> text files and it should be as fas
Koti,
You can use File::List module which does your task very easily.
Regards,
Ganesh
On Tue, Dec 2, 2008 at 5:18 PM, Koti <[EMAIL PROTECTED]> wrote:
> Hi Matt, A very Good Morning, Need a small Info for my problem.
>
> I have a directory named "X" which has many sub directories
> "Y","Z","W" a
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Dec 2, 2008, at 11:51 AM, John W. Krahn wrote:
James Moser wrote:
On Dec 2, 2008, at 5:48 AM, Koti wrote:
I have a directory named "X" which has many sub directories
"Y","Z","W" and many files about 20 , and these sub directories also
contain
James Moser wrote:
On Dec 2, 2008, at 5:48 AM, Koti wrote:
I have a directory named "X" which has many sub directories
"Y","Z","W" and many files about 20 , and these sub directories also
contain some more sub directories and files in them and those sub
directories also contain more directorie
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Dec 2, 2008, at 5:48 AM, Koti wrote:
Hi Matt, A very Good Morning, Need a small Info for my problem.
I have a directory named "X" which has many sub directories
"Y","Z","W" and many files about 20 , and these sub directories also
contain some m
On Tue, Dec 2, 2008 at 06:48, Koti <[EMAIL PROTECTED]> wrote:
> Hi Matt, A very Good Morning, Need a small Info for my problem.
>
> I have a directory named "X" which has many sub directories
> "Y","Z","W" and many files about 20 , and these sub directories also
> contain some more sub directories
From: AndrewMcHorney <[EMAIL PROTECTED]>
> I am continuing work on my script. I know there are many ways to read
> files. I am going to be opening files that are text and also that are binary.
>
> Here are my 2 ways that I have done it it in the past. I am wondering
> which way is best.
>
> $_
On Sun, 2008-10-26 at 09:15 -0700, AndrewMcHorney wrote:
> Hello
>
> I am continuing work on my script. I know there are many ways to read
> files. I am going to be opening files that are text and also that are binary.
>
> Here are my 2 ways that I have done it it in the past. I am wondering
>
Joseph L. Casale wrote:
> I have to search for text strings in files and then do something with the
> line that matches in one scenario and in another I need to store the
> contents of the following n lines.
>
> In the first requirement I think I have it beat, but I am lost on the
> second. I thou
Joseph L. Casale wrote:
> I have to search for text strings in files and then do something with the
> line that matches in one scenario and in another I need to store the contents
> of the following n lines.
>
> In the first requirement I think I have it beat, but I am lost on the second.
> I th
Joseph L. Casale wrote:
I have to search for text strings in files and then do something with
the line that matches in one scenario and in another I need to store
the contents of the following n lines.
In the first requirement I think I have it beat, but I am lost on the
second. I thought I m
On Dec 3, 2003, at 7:44 AM, [EMAIL PROTECTED] wrote:
how can I dup file handles
do you mean:
open(LOG, ">>/tmp/logfile");
open(STDERR, ">&LOG");
hence you code is One $ over the line?
#!/usr/bin/perl -w
use strict; # this would help you with finding those
Hi Bob,
Thanks for a good reply, see my coments under your questions.
- Original Message -
From: Bob Showalter <[EMAIL PROTECTED]>
Date: Wednesday, December 3, 2003 9:54 am
Subject: RE: Reading files
> [EMAIL PROTECTED] wrote:
> > Hello All,
> > I am trying to o
[EMAIL PROTECTED] wrote:
> Hello All,
> I am trying to open a file once , and then duplicate it's
> File Handle. I am trying to workout example straight from
> FAQ5, with no luck.
What does "no luck" mean? You never tell us what happens when you run your
code.
> I will basicly trying to open a f
> OK, but how about:
>
> 1)where is $LOG being set?
$LOG is the first opened filehandle...
> 2)does it get past the dies shown below?
> 3)got strict? it's 'fer your own good, you know! ;)
>
Good question, good point
> -Tom Kinzer
>
>
>
> #!/usr/bin/perl -w
>
> $file="./text";
> $|=1;
-Original Message-
From: Mark Goland [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 02, 2003 7:40 PM
To: [EMAIL PROTECTED]
Subject: Re: Reading files
Sorry for not being more clear. The problem is that it doesnt seem to be
able to read of the duped handle { $line2 is empty on }.
- Or
Sorry for not being more clear. The problem is that it doesnt seem to be
able to read of the duped handle { $line2 is empty on }.
- Original Message -
From: "Tom Kinzer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 02, 2003 4:15 PM
Subject: R
I don't see $LOG being set...strict would catch that.
-Tom Kinzer
> Hello All,
> I am trying to open a file once , and then duplicate it's
> File Handle. I am trying to workout example straight from
> FAQ5, with no luck. I will basicly trying to open a file, dup
> off a few handles and sprea
> Hello All,
> I am trying to open a file once , and then duplicate it's
> File Handle. I am trying to workout example straight from
> FAQ5, with no luck. I will basicly trying to open a file, dup
> off a few handles and spread them across other processes.
> Here is the code
>
Try use strict;
start off by putting some "or die"s on those file opens.
where are you breaking or what is the error message?
not sure what the problem is exactly.
-Tom Kinzer
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 02, 2003 9:53 AM
To: [EMAIL PROTE
didn't get you
what do u need to ask?
Aman Raheja
Systems Analyst
AGF Technologies
www.agftech.com
- Original Message -
From: "James Parsons" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 30, 2003 1:23 PM
Subject: Reading files in a directory
> Hi all
>
> I've
> Hi all
Howdy
>
> I've this Perl script to read all files in a directory and
> if it finds a file with a certain then rename the file to header
>
Sounds like it might be handy.
DMuey
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
mario kulka wrote:
> Before I upload a file with a random name I would like to make sure
> that another file with the same name doesn't already exist. Is there
> a way to look for a specific $name file within a directory (on UNIX).
Be aware that algorithms using -e or similar to check for the exis
Hi Mario,
On Sat, Feb 01, 2003 at 06:35:55AM +, mario kulka wrote:
> Before I upload a file with a random name I would like to make sure that
> another file with the same name doesn't already exist. Is there a way to
> look for a specific $name file within a directory (on UNIX).
if( -e $fil
On Sat, Feb 01, 2003 at 06:35:55AM +, mario kulka wrote:
> Before I upload a file with a random name I would like to make sure that
> another file with the same name doesn't already exist. Is there a way to
> look for a specific $name file within a directory (on UNIX).
To check whether a fi
- Original Message -
From: "Sandhya Sankaran" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 30, 2001 8:35 PM
Subject: Reading files into arrays
> I have just started programming in Perl and i need a solution to the
> following problem :
>
> I have a file like this :
> I have just started programming in Perl and i need a solution to the
> following problem :
>
> I have a file like this :
> >gi|56746574|
> fjhgfjhgfhgghdgfdhjsfghdfjdksjdijkjdskjdkjkjlopodlskdldkksjdkjf
>
fjhgfjhgfhgghdgfdhjsfghdfjdksjdijkjdskjdkjkjlopodlskdldkksjdkjffjhgfjhgfhggh
>
dgfdhjsfghdf
Hi,
Try out this code,
#!/usr/bin/perl
@lines;
$array_counter=0;
open(fd, "file.txt");
$line=;
while($line) {
if($line =~ /\>gi\|[\d+]/) {
$line=;
@lines[$array_counter++]=$line;
}
$line=;
}
print @lines;
close(fd);
Assume file.txt is the file out here. And @lines wil
37 matches
Mail list logo