[29357] in Perl-Users-Digest
Perl-Users Digest, Issue: 601 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 29 11:10:08 2007
Date: Fri, 29 Jun 2007 08:09:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 29 Jun 2007 Volume: 11 Number: 601
Today's topics:
Re: "Convert" perl command line to simple script <Peter@PSDT.com>
Re: 2 dimentional data call within a conditional fzxdf5@gmail.com
Re: Assigning another filehandle to STDOUT, using binmo <a24061@ducksburg.com>
Re: Assigning another filehandle to STDOUT, using binmo <a24061@ducksburg.com>
best Excel module cartercc@gmail.com
Re: best Excel module <yankeeinexile@gmail.com>
Re: date parts in one step <baxter.brad@gmail.com>
Re: date parts in one step <baxter.brad@gmail.com>
Re: fedora core 5 + install net::ssh::perl = hangs <simon.andrews@bbsrc.ac.uk>
Re: Kicking off multiple processes at once instead of w <shmh@bigpond.net.au>
Re: Kicking off multiple processes at once instead of w <joe+usenet@sunstarsys.com>
Re: Kicking off multiple processes at once instead of w <shmh@bigpond.net.au>
Re: Kicking off multiple processes at once instead of w QoS@domain.invalid
Re: new in CGI::Session::Driver::postgredsql nonexistin <ulvinge@gmail.com>
Re: new in CGI::Session::Driver::postgredsql nonexistin <gautam.chekuri@gmail.com>
portable /dev/null ? <larry.grant.dc@gmail.com>
Re: portable /dev/null ? <jurgenex@hotmail.com>
Re: Problem with PERL function <bugbear@trim_papermule.co.uk_trim>
Re: Problem with PERL function <bugbear@trim_papermule.co.uk_trim>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 29 Jun 2007 13:21:41 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: "Convert" perl command line to simple script
Message-Id: <pan.2007.06.29.13.21.41.106304@PSDT.com>
On Thu, 28 Jun 2007 15:44:07 +0000, bluez34me wrote:
> perl -pi -e 's/..\index/index/g' *.html
>
> Is there some "standard" and simple way to get this into script form,
Yes. perldoc B::Deparse.
$ perl -MO=Deparse -pi -e 's/..\index/index/g'
BEGIN { $^I = ""; }
LINE: while (defined($_ = <ARGV>)) {
s/..index/index/g;
}
continue {
print $_;
}
-e syntax OK
So:
$ echo '#!'`which perl` > htmlchg
$ perl -MO=Deparse -pi -e 's/..\index/index/g' >> htmlchg
-e syntax OK
$ chmod +x htmlchg
$ ./htmlchg *html
Voila.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: Fri, 29 Jun 2007 07:13:17 -0700
From: fzxdf5@gmail.com
Subject: Re: 2 dimentional data call within a conditional
Message-Id: <1183126397.072349.187590@g4g2000hsf.googlegroups.com>
On Jun 28, 4:49 pm, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
wrote:
> fzx...@gmail.com wrote:
> > Greetings,
>
> > I am trying to get this snippet to run...but it fails at the
> > conditional "if" portion.
>
> What fails?
>
>
>
> > I think the problem lies in the ...m/\$data[$r][0]\b/...build
> > portion. I've even 'built" the search expression around a non-arrayed
> > variable with no luck
>
> No idea what a 'build portion' is..
>
>
>
> > What am I doing wrong?
>
> use strict;
> use warnings;
>
>
>
> > @data= ( ["junk",3,1,3,4], ["trash",4,2,3,4,6] );
>
> > @money = ( "junk", "trash");
>
> > for ($r=0; $r<2; $r++)
> > {
> > if ($money[$r] =~ m/\$data[$r][0]\b/ )
>
> ^ no need to escape the '$'.
> if ($money[$r] =~ m/$data[$r][0]\b/ )
>
> Why use a match at all??
>
> if( $money[ $r ] eq $data[$r][0] )
>
> > {
> > print "data[$r][0] = $data[$r]->[0];
>
> print "data[$r][0]=$data[$r][0]\n";
>
>
>
> > }
> > }- Hide quoted text -
>
> - Show quoted text -
Thank you for your quick reply...I see what you mean with a complete
field match. This pointed out an error in my provided snippet of what
I'm trying to extract from the array
In my original snippet...I made an error in my $data line
presentation...it should have read
@data= ( ["crushed junk car",3,1,3,4], ["green trash can",
4,2,3,4,6] );
where I'm searching for a string segment in the first array position.
Sorry about this oversite.
------------------------------
Date: Fri, 29 Jun 2007 11:25:21 +0100
From: Adam Funk <a24061@ducksburg.com>
Subject: Re: Assigning another filehandle to STDOUT, using binmode.
Message-Id: <h93fl4-gsg.ln1@news.ducksburg.com>
On 2007-06-26, Peter J. Holzer wrote:
>> Now I'm surprised that the following dippy little tag-stripping
>> program, which is XML-unaware and has no settings whatever relating to
>> encoding, works.
...
>> When I run this over my UTF-8 XML files, I get correct-looking, mixed
>> Cyrillic and Roman output, with no warnings --- why?
>
> Because UTF-8 is designed in such a way that this should work :-).
>
> Your program reads and writes the files as a series of bytes. If your
> file contains a cyrillic character, for example "?", it will read and
> write two bytes (0xD0 0x91) instead. Since that happens both on input
> and on output, it doesn't matter. If you treat the individual bytes of a
> multibyte character as characters, then your program will break. For
> example, if you want to insert a blank before each character and put a
>
> $line =~ s!(.)| $1|g;
>
> in your program it won't work because it converts the byte sequence
> 0xD0 0x91 into the byte sequence 0x20 0xD0 0x20 0x91, which is not a
> proper UTF-8 sequence. You must properly decode your input and encode
> your output if you want to do this (or deal with the encoding in your
> code).
I think I'm getting this. Thanks!
------------------------------
Date: Fri, 29 Jun 2007 11:24:11 +0100
From: Adam Funk <a24061@ducksburg.com>
Subject: Re: Assigning another filehandle to STDOUT, using binmode.
Message-Id: <b73fl4-gsg.ln1@news.ducksburg.com>
On 2007-06-26, Dr.Ruud wrote:
> Adam Funk schreef:
>
>> I think I get it. String literals and variables just contain strings
>> of bytes, and encoding is a consideration only for input and output
>> --- or is that only for output?
>
> A Perl text string contains characters. See perlunitut:
> http://search.cpan.org/perldoc?perlunitut
I think I'm finally figuring this out. Thanks.
------------------------------
Date: Fri, 29 Jun 2007 06:48:50 -0700
From: cartercc@gmail.com
Subject: best Excel module
Message-Id: <1183124930.405737.223200@u2g2000hsc.googlegroups.com>
A couple of years ago, I converted our database output from wide
formfeed paper printed on obselete line printers and delivered
manually to printing them as PDF files delievered electronically. I am
now converting our database output into CSV or XML files that can be
opened with Excel, which is the user desiderata. Some of these files
have hundreds of records, and PDF files can't be sorted or filtered,
although they are a lot better than the old line printed variety.
However, I am getting user complaints that the Excel files are ugly,
without all the nice formatting that Excel supports. I have just
looked at CPAN and discovered 149 modules for use with Excel, and see
several that might do what I need, such as Spreadsheet::WriteExcel,
Querylet::Output::Excel::OLE, Querylet::Output::Excel::XLS,
Spreadsheet::SimpleExcel, etc.
Are there maybe two or three that I can test that focus on cosmetics?
I need something that can create colored backgrounds with bolded text,
etc.
Thanks, CC.
------------------------------
Date: 29 Jun 2007 09:00:53 -0500
From: Lawrence Statton <yankeeinexile@gmail.com>
Subject: Re: best Excel module
Message-Id: <87ps3e273e.fsf@gmail.com>
cartercc@gmail.com writes:
>
> Are there maybe two or three that I can test that focus on cosmetics?
> I need something that can create colored backgrounds with bolded text,
> etc.
>
Spreadsheet::WriteExcel is my personal favorite, and my picky ("Can
you make that a bluer shade of blue?") customers love the output.
--
Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
place them into the correct order.
------------------------------
Date: Fri, 29 Jun 2007 14:19:59 -0000
From: Brad Baxter <baxter.brad@gmail.com>
Subject: Re: date parts in one step
Message-Id: <1183126799.261757.36380@q69g2000hsb.googlegroups.com>
On Jun 28, 1:24 pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
> On 2007-06-28 13:18, Brad Baxter <baxter.b...@gmail.com> wrote:
>
> > That's close. I actually meant that in the worst case, you'll wait an
> > extra 0.0000015 seconds. There's no real case I can imagine when
> > you're going to request the value of the month and year 10_000_000
> > times, or even twice.
>
> For the current year and month, yes. But you may be reading timestamps
> from a logfile or database and calculating year and month for each of
> them. Even then I suspect that other operations you do on the data swamp
> the differences (But a long time ago I found that the bottleneck in a C
> program I had written was either in localtime or mktime (I don't
> remember) and I sped it up significantly by reimplementing that
> function - so it's certainly possible).
Certainly, when the code is in a loop. I just didn't think that
particular code would be.
--
Brad
------------------------------
Date: Fri, 29 Jun 2007 14:50:00 -0000
From: Brad Baxter <baxter.brad@gmail.com>
Subject: Re: date parts in one step
Message-Id: <1183128600.300143.29470@m36g2000hse.googlegroups.com>
On Jun 27, 8:10 pm, "Petr Vileta" <sto...@practisoft.cz> wrote:
> Brad Baxter wrote:
> > On Jun 24, 10:08 am, "Petr Vileta" <sto...@practisoft.cz> wrote:
> >> Function 1 : 37 seconds
> >> Function 2 : 52 seconds
> >> Function 3 : 44 seconds
>
> > So, given that it's a line of code that you'll execute exactly once,
> > it looks like a toss-up to me. :-)
>
> Sorry, English is my second language and is pretty poor - I don't understand
> you. Can you say that something is wrong in my test code or the results are
> not true? I tested it 5 times on the Windows machine with killed all not
> needed other programs and services (Skype, ICQ, MySQL server etc.) The
> results was be the same 5 times.
Hi, as others have said, I meant that it probably doesn't matter much
which option you choose. Unless you're doing something different that
just calling localtime for the current month and year, and you're
doing so in a tight loop.
Just for the record, there actually are a few things wrong with the
code you posted.
use strict;
my ($start, $stop)
$start = localtime;
__END__
Scalar found where operator expected at ./qt2 line 5, near ")
$start"
(Missing semicolon on previous line?)
syntax error at ./qt2 line 5, near ")
$start "
Global symbol "$start" requires explicit package name at ./qt2 line 5.
Execution of ./qt2 aborted due to compilation errors.
____________
use strict;
use warnings; # added
my ($start, $stop); # fixed
$start = localtime;
# snip
$stop = localtime;
print 'Function 1: ', $stop - $start, " seconds\n"; # line 13
__END__
Argument "Fri Jun 29 10:28:02 2007" isn't numeric in subtraction (-)
at ./qt2 line 13.
Argument "Fri Jun 29 10:28:02 2007" isn't numeric in subtraction (-)
at ./qt2 line 13.
Function 1: 0 seconds
____________
Did you type the code instead of cutting and pasting it?
You might like Benchmark:
use strict;
use warnings;
use Benchmark qw( cmpthese ) ;
cmpthese( -1, {
a => q{my @a=(localtime)[4,5]; my ($m, $y) = ($a[0] + 1, $a[1] +
1900);},
b => q{my ($m, $y) = map { $$_[0] + 1, $$_[1] + 1900 } [(localtime)
[4,5]];},
c => q{my ($m, $y) = sub { $_[ 4] + 1, $_[ 5] + 1900 }-
>(localtime);},
} );
cmpthese( -1, {
a => sub{my @a=(localtime)[4,5]; my ($m, $y) = ($a[0] + 1, $a[1] +
1900);},
b => sub{my ($m, $y) = map { $$_[0] + 1, $$_[1] + 1900 }
[(localtime)[4,5]];},
c => sub{my ($m, $y) = sub { $_[ 4] + 1, $_[ 5] + 1900 }-
>(localtime);},
} );
__END__
Rate b c a
b 91897/s -- -16% -30%
c 109226/s 19% -- -17%
a 131022/s 43% 20% --
Rate b c a
b 88494/s -- -19% -29%
c 109226/s 23% -- -13%
a 124842/s 41% 14% --
--
Brad
------------------------------
Date: Fri, 29 Jun 2007 14:52:56 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: fedora core 5 + install net::ssh::perl = hangs
Message-Id: <f632rm$87i$1@south.jnrs.ja.net>
luc2 wrote:
> hello,
>
> when trying to install net::ssh::perl on fedora core 5, it hangs at this
> step :
Why not use the pre-built package?
yum install perl-Net-SSH-Perl
[Haven't checked in FC5 but it's there in FC6 and F7]
Simon.
------------------------------
Date: Fri, 29 Jun 2007 10:37:23 GMT
From: "Simon" <shmh@bigpond.net.au>
Subject: Re: Kicking off multiple processes at once instead of waiting....
Message-Id: <Dh5hi.933$4A1.42@news-server.bigpond.net.au>
Hi QoS,
Thanks for your input.
Do you mean the module Threads?
<QoS@domain.invalid> wrote in message news:qr%gi.5424$ss5.76@trndny03...
>
> "Simon" <shmh@bigpond.net.au> wrote in message-id:
> <zY_gi.458$4A1.369@news-server.bigpond.net.au>
>
>>
>> Hi guys hope you can help.
>>
>> I have the following script which connects to remote machines and returns
>> information about the values of certain registry keys.
>> All is good, but the way the script runs is that it does this....
>> Connects to first machine.......returns data
>> Then connects to next machine....returns data
>> Then the next
>> Then the next and so on.
>>
>> What Id like to be able to do, because we have so many machines to
>> process,
>> is to do the following...
>>
>> Connect to, say 10 machines all at the same time, then return data back
>> to
>> the one main console (where I executed the script in the first place),
>> instead of waiting for 1 machine to end, then move on to the next.
>>
>> Any help greatly appreciated. Here is the script.
>>
>> ================================================================= Script
>>
>> use Win32;
>> use Win32::Registry;
>>
>> sub RunRegQuery {
>>
>> $p = 'Software\Network Associates\TVD\VirusScan
>> Enterprise\CurrentVersion';
>> Win32::RegOpenKeyEx(&HKEY_LOCAL_MACHINE,$p,&NULL,&
>> KEY_QUERY_VALUE|&KEY_SET_VALUE,$hkey);
>> Win32::RegQueryValueEx($hkey,"szVirDefVer",&NULL,$ type,$Definition);
>> Win32::RegQueryValueEx($hkey,"szProductVer",&NULL, $type,$Product);
>> Win32::RegQueryValueEx($hkey,"szEngineVer",&NULL,$ type,$Engine);
>>
>> print "$SystemName\n";
>> print "$Definition\n";
>> print "$Product\n";
>> print "$Engine\n";
>> print " \n";
>> }
>>
>> ##########
>> ## MAIN ##
>> ##########
>>
>> open (Store, "< llsystems.txt") or die "can't open systems.txt: $!";
>> foreach $line (<Store>)
>> {
>> chomp($line);
>> $SystemName = $line;
>> if ($SystemName =~ /^l/i) {
>> system ("net use \\\\$SystemName\\ipc\$ "password"
>> /user:$SystemName\\useraccount > NUL");
>> sleep 3;
>> RunRegQuery();
>> system ("net use \\\\$SystemName\\ipc\$ /delete /y > 2NUL > NUL"); #
>> Delete
>> previous connection
>> }
>> else {
>> print "not a valid system\n";
>> }
>> }
>> close (Store);
>> exit;
>>
>> =================================================================== End
>> of
>> script
>>
>> Output is as follows..
>>
>> C:\>script.pl
>> Lcomputer1
>> 5060
>> 8.0.0.912
>> 5100
>> Lcomputer2
>> 5060
>> 8.0.0.912
>> 5100
>> Lcomputer3
>> 5060
>> 8.0.0.912
>> 5100
>>
>> etc etc
>>
>> Any help greatly appreciated guys, thank you.
>>
>> S
>
> Just use Threads
>
------------------------------
Date: Fri, 29 Jun 2007 07:04:21 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Kicking off multiple processes at once instead of waiting....
Message-Id: <876457m37u.fsf@gemini.sunstarsys.com>
"Simon" <shmh@bigpond.net.au> writes:
> What Id like to be able to do, because we have so many machines to
> process, is to do the following...
>
> Connect to, say 10 machines all at the same time, then return data
> back to the one main console (where I executed the script in the first
> place), instead of waiting for 1 machine to end, then move on to the
> next.
>
> Any help greatly appreciated. Here is the script.
>
> ================================================================= Script
>
> use Win32;
> use Win32::Registry;
[...]
> system ("net use \\\\$SystemName\\ipc\$ "password"
> /user:$SystemName\\useraccount > NUL");
> sleep 3;
> RunRegQuery();
> system ("net use \\\\$SystemName\\ipc\$ /delete /y > 2NUL > NUL"); # Delete
> previous connection
What you want to do sounds fine, but personally I don't think you're
asking the right question. What you should be asking is "How do I get
rid of these system() calls in my script?", because there's no way
to parallelize your script without doing at least that.
If I were you, I'd be looking over the Win32::Registry documentation
for a way to directly connect to a remote registry. If you can figure
out how to do that, you should be able to access the repository by
calling a suitably modified version of
RunRegQuery($SystemName);
without ever needing to make those calls to system() and sleep().
If it turns out *that* script isn't fast enough, at that point people
will be able to give you advice on how to parallellize it like you
have originally asked.
--
Joe Schaefer
------------------------------
Date: Fri, 29 Jun 2007 11:36:22 GMT
From: "Simon" <shmh@bigpond.net.au>
Subject: Re: Kicking off multiple processes at once instead of waiting....
Message-Id: <W86hi.950$4A1.185@news-server.bigpond.net.au>
Thanks Joe..much appreciated.
I do know Joe how to connect to a remote registry.
I spose what Im trying to do, but cant get myself on some really really
simple examples, so i can play with them, are example scripts on how to fork
a process.
Ive looked at the perldoc but I find the doco not as clear as some good
beginner fork examples so I can test them out on my systems, then gain
confidence that way.
Appreciate your help. :)
"Joe Schaefer" <joe+usenet@sunstarsys.com> wrote in message
news:876457m37u.fsf@gemini.sunstarsys.com...
> "Simon" <shmh@bigpond.net.au> writes:
>
>> What Id like to be able to do, because we have so many machines to
>> process, is to do the following...
>>
>> Connect to, say 10 machines all at the same time, then return data
>> back to the one main console (where I executed the script in the first
>> place), instead of waiting for 1 machine to end, then move on to the
>> next.
>>
>> Any help greatly appreciated. Here is the script.
>>
>> ================================================================= Script
>>
>> use Win32;
>> use Win32::Registry;
>
>
> [...]
>
>> system ("net use \\\\$SystemName\\ipc\$ "password"
>> /user:$SystemName\\useraccount > NUL");
>> sleep 3;
>> RunRegQuery();
>> system ("net use \\\\$SystemName\\ipc\$ /delete /y > 2NUL > NUL"); #
>> Delete
>> previous connection
>
> What you want to do sounds fine, but personally I don't think you're
> asking the right question. What you should be asking is "How do I get
> rid of these system() calls in my script?", because there's no way
> to parallelize your script without doing at least that.
>
> If I were you, I'd be looking over the Win32::Registry documentation
> for a way to directly connect to a remote registry. If you can figure
> out how to do that, you should be able to access the repository by
> calling a suitably modified version of
>
> RunRegQuery($SystemName);
>
> without ever needing to make those calls to system() and sleep().
>
> If it turns out *that* script isn't fast enough, at that point people
> will be able to give you advice on how to parallellize it like you
> have originally asked.
>
> --
> Joe Schaefer
------------------------------
Date: Fri, 29 Jun 2007 14:54:08 GMT
From: QoS@domain.invalid
Subject: Re: Kicking off multiple processes at once instead of waiting....
Message-Id: <k29hi.11$4e5.4@trndny07>
"Simon" <shmh@bigpond.net.au> wrote in message-id: <Dh5hi.933$4A1.42@news-server.bigpond.net.au>
>
> Hi QoS,
>
> Thanks for your input.
>
> Do you mean the module Threads?
>
>
> <QoS@domain.invalid> wrote in message news:qr%gi.5424$ss5.76@trndny03...
> >
> > "Simon" <shmh@bigpond.net.au> wrote in message-id:
> > <zY_gi.458$4A1.369@news-server.bigpond.net.au>
> >
> >>
[snip]
> >> Connect to, say 10 machines all at the same time, then return data back
> >> to
> >> the one main console (where I executed the script in the first place),
> >> instead of waiting for 1 machine to end, then move on to the next.
> >>
> >> Any help greatly appreciated. Here is the script.
> >>
[snip]
> >> Any help greatly appreciated guys, thank you.
> >>
> >> S
> >
> > Just use Threads
> >
Yeah have a look at:
perldoc perlthrtut
and
perldoc Threads
and
perldoc Threads::Shared
HtH
J
------------------------------
Date: Fri, 29 Jun 2007 11:15:37 -0000
From: IDK <ulvinge@gmail.com>
Subject: Re: new in CGI::Session::Driver::postgredsql nonexisting
Message-Id: <1183115737.073436.38720@n2g2000hse.googlegroups.com>
On Jun 29, 9:51 am, Joe Smith <j...@inwap.com> wrote:
> IDK wrote:
> > With strict I only get loads of:
> > login: Global symbol "$s" requires explicit package name at ./login
> > line 25.
>
> > $s = sqlQuerry("SELECT id, pass FROM zerus.players WHERE
> > name='$user'")
>
> Put "my" in front of the first time where the variable $s is used.
> my $s = sqlQuerry...
Thanks!
That solved one problem, but the big one still remains...
------------------------------
Date: Fri, 29 Jun 2007 13:52:08 -0000
From: gautam chekuri <gautam.chekuri@gmail.com>
Subject: Re: new in CGI::Session::Driver::postgredsql nonexisting
Message-Id: <1183125128.686513.97970@e9g2000prf.googlegroups.com>
On Jun 29, 4:15 pm, IDK <ulvi...@gmail.com> wrote:
> On Jun 29, 9:51 am, Joe Smith <j...@inwap.com> wrote:
>
> > IDK wrote:
> > > With strict I only get loads of:
> > > login: Global symbol "$s" requires explicit package name at ./login
> > > line 25.
>
> > > $s = sqlQuerry("SELECT id, pass FROM zerus.players WHERE
> > > name='$user'")
>
> > Put "my" in front of the first time where the variable $s is used.
> > my $s = sqlQuerry...
>
> Thanks!
>
> How can the above code work?
> "driver:postgresql:id:md5" should be "driver:postgresql;id:md5".
> Atleast as I interpret the docs...
Well that works because parse_dsn in CGI::Session does the following :
my %dsn_map = map { split /:/ } (split /;/, $dsn_str);
Hence, it work for both : and ; ..
> That solved one problem, but the big one still remains...
------------------------------
Date: Fri, 29 Jun 2007 07:57:54 -0700
From: Larry <larry.grant.dc@gmail.com>
Subject: portable /dev/null ?
Message-Id: <1183129074.575021.46410@w5g2000hsg.googlegroups.com>
I want to run an external command using "system" but discard its
standard output. I know under *nix I could do:
system 'myCmd > /dev/null';
and Windows:
system 'myCmd > nul';
but is there a more portable way to do that?
------------------------------
Date: Fri, 29 Jun 2007 15:03:25 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: portable /dev/null ?
Message-Id: <1b9hi.8$105.6@trndny08>
Larry wrote:
> I want to run an external command using "system" but discard its
> standard output. I know under *nix I could do:
>
> system 'myCmd > /dev/null';
>
> and Windows:
>
> system 'myCmd > nul';
>
> but is there a more portable way to do that?
If you would drop your requirement of using system(), then you could use
backticks and capture (and then discard) the output in your Perl program.
jue
------------------------------
Date: Fri, 29 Jun 2007 14:00:39 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Problem with PERL function
Message-Id: <46850277$0$8753$ed2619ec@ptn-nntp-reader02.plus.net>
michaelzhao wrote:
> Here is my code. Keep in mind that this is like my 2nd week on Perl so
> it probably is pretty crappy ;). Try not to give me too much flak
> about it.
>
> The DNA File is called "verified.fa". It is a FASTA file, a common
> file format for storing DNA strings.
If you need repeated "as fast possible" access to the stats
for arbitrary subsequences you might consider the following
approach.
Have an array for each base (CAGT) so,
@C, @A, @G, @T.
At each position for the sequence 'i', the arrays
should hold the total count of the bases up to that
position.
Then, for any subsequence from i1 to i2, the correct count
for (e.g. A) would be
$A[i2] - $A[i1],
and so on for the other bases.
BugBear
------------------------------
Date: Fri, 29 Jun 2007 14:05:11 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Problem with PERL function
Message-Id: <46850387$0$8753$ed2619ec@ptn-nntp-reader02.plus.net>
bugbear wrote:
> michaelzhao wrote:
>> Here is my code. Keep in mind that this is like my 2nd week on Perl so
>> it probably is pretty crappy ;). Try not to give me too much flak
>> about it.
>>
>> The DNA File is called "verified.fa". It is a FASTA file, a common
>> file format for storing DNA strings.
>
> If you need repeated "as fast possible" access to the stats
> for arbitrary subsequences you might consider the following
> approach.
>
> Have an array for each base (CAGT) so,
>
> @C, @A, @G, @T.
>
> At each position for the sequence 'i', the arrays
> should hold the total count of the bases up to that
> position.
>
> Then, for any subsequence from i1 to i2, the correct count
> for (e.g. A) would be
>
> $A[i2] - $A[i1],
>
> and so on for the other bases.
Dang - just thought of something else
For a 25% storage saving (since
each of my suggested arrays has as many entries as the sequence is
long), you only need 3 arrays, since the fourth
count is length-of-sequence - (sum of other 3 counts)
BugBear
------------------------------
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 V11 Issue 601
**************************************