Hi Jim,
Thanks again. Very helpful as usual!
T.
On 2013-02-13, at 11:37 PM, Jim Gibson wrote:
>
> On Feb 13, 2013, at 6:47 PM, Tiago Hori wrote:
>
>> Hey Guys,
>>
>> I am still at the same place. I am writing these little pieces of code to
>> try to learn the language better, so any advice
Hi John,
Thanks.
What I was trying to do there was to test if there was any numbers in the the
first element of the first line. That was intended to get rid of the header
line. I meant to use [0-9]* as character class to say "if there aren't any
number of integers in the first element, next".
Tiago Hori wrote:
Hey Guys,
Hello,
I am still at the same place. I am writing these little pieces of code to
try to learn the language better, so any advice would be useful. I am again
parsing through tab delimited files and now trying to find fish from on id
(in these case families AS5 and
On Feb 13, 2013, at 6:47 PM, Tiago Hori wrote:
> Hey Guys,
>
> I am still at the same place. I am writing these little pieces of code to
> try to learn the language better, so any advice would be useful. I am again
> parsing through tab delimited files and now trying to find fish from on id
> (i
Hey Guys,
I am still at the same place. I am writing these little pieces of code to
try to learn the language better, so any advice would be useful. I am again
parsing through tab delimited files and now trying to find fish from on id
(in these case families AS5 and AS9), retrieve the weights and
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
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 subroutine is cro
I got to the bottom of this now. The file had previously been
encrypted. Doh!
Thanks,
Stuart
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
Hi Kryten,
Could you please post a sample content of the file and the actual content
that is being displayed by the script on your editor.
Also kind send the output of following script and check if its same as your
previous output.
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
#ope
Hi Kryten,
On Friday 15 October 2010 08:42:07 Kryten wrote:
> Hi,
> I'm hitting a strange problem running simple perlscript on my new
> laptop.
>
> To illustrate:-
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> use diagnostics;
>
> open my $configuration, 'H:\temp.txt' or die "my error: $!
Hi,
I'm hitting a strange problem running simple perlscript on my new
laptop.
To illustrate:-
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
open my $configuration, 'H:\temp.txt' or die "my error: $!" ;
my @info = <$configuration> ;
chomp (@info);
foreach my $i (@info) { print "$i\n
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 +=
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;
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 file
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 fast as perl
open FILE, $file or die "bad fil
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
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 and files in them and those sub
directories also contain more directori
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
>
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
which way is best.
$_ = join '',() or @SourceLine = ()
Which one i
On Jan 11, 5:28 am, [EMAIL PROTECTED] (Rob Dixon) wrote:
> Enjoy_Life wrote:
>
> >
>
>
>
> > hi, who can tell me which is better of the following codes?
> > why there are different methods to read files?
> > thanks
>
> > 1. open(INPUT, "< filedata") or die "Couldn't open filedata for reading:
> >
Enjoy_Life wrote:
>
hi, who can tell me which is better of the following codes?
why there are different methods to read files?
thanks
1. open(INPUT, "< filedata") or die "Couldn't open filedata for reading:
$!\n";
while () {
print if /blue/;
}
close(INPUT);
2. use IO::File;
thanks
On Jan 11, 2008 5:04 PM, Jeff Pang <[EMAIL PROTECTED]> wrote:
> On Jan 11, 2008 2:00 PM, Enjoy_Life <[EMAIL PROTECTED]> wrote:
> > hi, who can tell me which is better of the following codes?
> > why there are different methods to read files?
> > thanks
> >
> > 1. open(INPUT, "< filedata")
On Jan 11, 2008 2:00 PM, Enjoy_Life <[EMAIL PROTECTED]> wrote:
> hi, who can tell me which is better of the following codes?
> why there are different methods to read files?
> thanks
>
> 1. open(INPUT, "< filedata") or die "Couldn't open filedata for reading:
> $!\n";
> while () {
> pr
hi, who can tell me which is better of the following codes?
why there are different methods to read files?
thanks
1. open(INPUT, "< filedata") or die "Couldn't open filedata for reading:
$!\n";
while () {
print if /blue/;
}
close(INPUT);
2. use IO::File;
$input = IO::File->ne
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
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 might be able to search for
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;
To: [EMAIL PROTECTED]
Subject: Reading files
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. H
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
#!/usr/bin/perl -w
$file="./tex
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
> 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]
Hi all
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
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
"R. Joseph Newton" wrote:
>
> "John W. Krahn" wrote:
>
> > open() returns 'true' if the file was opened or 'false' if the file was
> > not opened.
>
> Not exactly. At least not on my Perl installation [5.6.1 on W2K]. open
> returns 1 on success, but does not return a value on failure.
perldoc
William Olbrys wrote:
>
>
> The problem is my search and replace does not work. I'm new to perl and
> I find the perlre syntax very confusing. I simply want to replace one
> word(a string) with a much bigger string! How are files accessed
> differently than regular strings? I don't receive an
"John W. Krahn" wrote:
> open() returns 'true' if the file was opened or 'false' if the file was
> not opened.
Not exactly. At least not on my Perl installation [5.6.1 on W2K]. open returns 1 on
success, but does not return a value on failure.
#!/usr/bin/perl -w
use strict;
use warnings;
my
Corrections
"R. Joseph Newton" wrote:
>
> What do you think you are dong here? As far as I know, open is a void function.
I was forgetting that it returns a true value, that can be tested by
open FILE, "< fileName" or fail_statement;
>
> perldoc -f open
>
> > $index = open (TEXT, "../htdocs/gam
William Olbrys wrote:
> I've started writing a simple perl script for a web site so I can update
> it more quickly, but as I have a bit of a problem.
>
> Here is what I have:
>
> #!c:/Perl/bin/perl
> print "Content-type: text/html\n\n";
> $game = open (TEXT, "../htdocs/gameplow/game");
What do yo
William Olbrys wrote:
>
> I've started writing a simple perl script for a web site so I can update
> it more quickly, but as I have a bit of a problem.
>
> Here is what I have:
>
> #!c:/Perl/bin/perl
You should enable warnings and strictures when developing your program.
use warnings;
use stri
I've started writing a simple perl script for a web site so I can update
it more quickly, but as I have a bit of a problem.
Here is what I have:
#!c:/Perl/bin/perl
print "Content-type: text/html\n\n";
$game = open (TEXT, "../htdocs/gameplow/game");
$index = open (TEXT, "../htdocs/gameplow/index")
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
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).
thanks,
M
_
Protect
- 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 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
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
dgfdhjsfghdfjdksjdijkjdskj
67 matches
Mail list logo