On 7/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
i have a hex value which needs to be checked if a particular bit is
set in that string.
You probably want to start with the hex() function, which turns a
string like '01AF' into a number. But there are other ways; if it's an
arbitrarily-
hello all,
i have a hex value which needs to be checked if a particular bit is
set in that string.
for example, i need to check if 12th bit is set.
i tried doing mask(0x1000) with my input value i receive, so that only
if 12th bit is 1, will the answer be onebut can i do a direct
comparison a
On 7/18/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
Chas,
Sorry but I am not clear on what you mean by reduce? Do you mean
remove all non numbers from the array?
snip
Sort of, the code doesn't modify the original array, it creates a new
array with only the values that are numbers.
--
To un
Chas,
Sorry but I am not clear on what you mean by reduce? Do you mean remove all non
numbers from the array?
Thanks!
jlc
-Original Message-
From: Chas Owens [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 18, 2007 4:31 PM
To: Joseph L. Casale
Cc: Xavier Noria; beginners@perl.org
Subject
On 7/18/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
Interesting,
I see from your regexp you use a \A and \z, from Perldoc this means:
\A Match only at beginning of string
\z Match only at end of string
Is "foo10bar" valid? /^$RE{num}{real}$/ says no, but /$RE{num}{real}/
says yes
On 7/18/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 7/18/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
> How can I detect this, I have been running some code for a few days to
> develop some files and ran into the situation where I am getting the
> following data for input:
>
> 14.95313 14.453
Interesting,
I see from your regexp you use a \A and \z, from Perldoc this means:
\A Match only at beginning of string
\z Match only at end of string
I am not sure I understand this requirement?
In my case, I am checking an array of 3 scalars. Does this make sense:
next unless @data =~
El Jul 18, 2007, a las 11:19 PM, Joseph L. Casale escribió:
How can I detect this, I have been running some code for a few days
to develop some files and ran into the situation where I am getting
the following data for input:
14.95313 14.45312 0
14.95313 1.570813E-015 0
14.95313 -14.45313
Joseph L. Casale wrote:
How can I detect this, I have been running some code for a few days to develop
some files and ran into the situation where I am getting the following data for
input:
14.95313 14.45312 0
14.95313 1.570813E-015 0
14.95313 -14.45313 0
-14.95313 -28.90625 0
-14.95313 -14.45
On 7/18/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
How can I detect this, I have been running some code for a few days to
develop some files and ran into the situation where I am getting the
following data for input:
14.95313 14.45312 0
14.95313 1.570813E-015 0
14.95313 -14.45313 0
-14.9531
How can I detect this, I have been running some code for a few days to develop
some files and ran into the situation where I am getting the following data for
input:
14.95313 14.45312 0
14.95313 1.570813E-015 0
14.95313 -14.45313 0
-14.95313 -28.90625 0
-14.95313 -14.45313 0
-14.95313 1.570813E-
On Wed, July 18, 2007 3:58 pm, John W. Krahn wrote:
> Paul wrote:
>> I have a line that is reading files from and array and copying to a
>> different directory. Is there a way to rename the file with regex at
>> the
>> same time?
>
> No, you have to store the modified file name in a different vari
On 7/18/07, Paul <[EMAIL PROTECTED]> wrote:
I have a line that is reading files from and array and copying to a
different directory. Is there a way to rename the file with regex at the
same time?
I'm wanting to remove spaces only in the filenames with:
s/\ //g
My copy line reads:
copy( "$dir/$
Paul wrote:
I have a line that is reading files from and array and copying to a
different directory. Is there a way to rename the file with regex at the
same time?
No, you have to store the modified file name in a different variable.
I'm wanting to remove spaces only in the filenames with:
s
kapil.V wrote:
Hi,
Hello,
su-2.05b# df -h .
Filesystem Size Used Avail Capacity Mounted on
/dev/ad0s1e 136G 102G 23G 82% /home
From my script I do:
my $du = qx#df -h \.#;
($total,$used) = $du =~ /([0-9]+(\.[ 0-9]+)?)[ M|G]/sg;
^ ^
On 7/18/07, Monty <[EMAIL PROTECTED]> wrote:
In studying network programming (and I'm just beginning at it), I see
where listen() is called to set up a socket that waits for incoming
connection requests. The next step appears to be a call to accept()
Unless you really need to work at this low
On 7/18/07, Rob Dixon <[EMAIL PROTECTED]> wrote:
snip
Your solution has the same problem that made my final one frustratingly
ugly: if a server name is missing from the last file in the list there
will be no corresponding trailing zero in the output file for that server.
snip
The answer is to u
I have a line that is reading files from and array and copying to a
different directory. Is there a way to rename the file with regex at the
same time?
I'm wanting to remove spaces only in the filenames with:
s/\ //g
My copy line reads:
copy( "$dir/$file", "$newdir/$file" );
If I need to work w
Rob Dixon wrote:
John W. Krahn wrote:
country wrote:
[snip]
Notice in File OUT for Server Name (wsompapgtw05),
since wsompapgtw05 does not appear in File A, the
value is replaced with '0'. How can I get perl to
place a '0' in the output file when a particular
server name appears in at leas
In studying network programming (and I'm just beginning at it), I see
where listen() is called to set up a socket that waits for incoming
connection requests. The next step appears to be a call to accept()
where the request is granted and the connection made on a new socket,
as in this code snippe
Chas Owens wrote:
On 7/18/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
Hrm,
I am confused then:)
I have this as a file I am using right now!
while () {
my @data = split;
next unless @data == 3;
next if grep (/[^0-9.-]/, @data);
printf FILEOUT "X%s Y%s\n", $dat
John W. Krahn wrote:
country wrote:
[snip]
Notice in File OUT for Server Name (wsompapgtw05),
since wsompapgtw05 does not appear in File A, the
value is replaced with '0'. How can I get perl to
place a '0' in the output file when a particular
server name appears in at least 1 of the input f
Rob Dixon wrote:
country wrote:
I have multiple CSV files (3 for this example) with
identical record layouts except that each Server Name may not be in
all of the files. Also the CSV files might not be sorted by Server
Name.
File A
Server Name,Avg CPU,P95 CPU,Avg Mem Util,P95 Mem Util
WSOMQAVPR
lnatz wrote:
Hi, I'm having an issue with here docs, and I'm sure it's something
simple that I'm overlooking but it's annoying me.
perldoc -q "HERE documents"
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short ord
country wrote:
I have multiple CSV files (3 for this example) with
identical record layouts except that each Server Name may not be in
all of the files. Also the CSV files might not be sorted by Server
Name.
File A
Server Name,Avg CPU,P95 CPU,Avg Mem Util,P95 Mem Util
WSOMQAVPRA05,93.75,95.87,66
lnatz wrote:
Hi, I'm having an issue with here docs, and I'm sure it's something
simple that I'm overlooking but it's annoying me. Here is a snippet
from my script.
sub usageAndDie {
print<> The following single-character otions are accepted:
>>wih arguments: -T -S
>>without ar
On 7/18/07, lnatz <[EMAIL PROTECTED]> wrote:
Hi, I'm having an issue with here docs, and I'm sure it's something
simple that I'm overlooking but it's annoying me. Here is a snippet
from my script.
snip
Its failing with the error: Can't find string terminator "EOF"
anywhere before EOF at exec_rn
Hi, I'm having an issue with here docs, and I'm sure it's something
simple that I'm overlooking but it's annoying me. Here is a snippet
from my script.
sub usageAndDie {
print<> The following single-character otions are accepted:
>>wih arguments: -T -S
>>without arguments(boolean)
On 7/18/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
Hrm,
I am confused then:)
I have this as a file I am using right now!
while () {
my @data = split;
next unless @data == 3;
next if grep (/[^0-9.-]/, @data);
printf FILEOUT "X%s Y%s\n", $data[0], $data[1];
country wrote:
#!/usr/bin/perl
use strict;
use warnings;
###
# Create File with Average CPU Numbers
###
my %resultacpu;
my @files = qw( FileA FileB FileC );
for my $file ("FileA","FileB","FileC") {
for my $i (
kapil.V wrote:
Hi,
su-2.05b# df -h .
Filesystem Size Used Avail Capacity Mounted on
/dev/ad0s1e 136G 102G 23G 82% /home
From my script I do:
my $du = qx#df -h \.#;
($total,$used) = $du =~ /([0-9]+(\.[ 0-9]+)?)[ M|G]/sg;
^^
looks fo
country wrote:
I have multiple CSV files (3 for this example) with
identical record layouts except that each Server Name may not be in
all of the files. Also the CSV files might not be sorted by Server
Name.
File A
Server Name,Avg CPU,P95 CPU,Avg Mem Util,P95 Mem Util
WSOMQAVPRA05,93.75,95.87,66
--- "kapil.V" <[EMAIL PROTECTED]> wrote:
> Hi,
> su-2.05b# df -h .
> Filesystem Size Used Avail Capacity Mounted on
> /dev/ad0s1e 136G 102G 23G 82% /home
>
> From my script I do:
>my $du = qx#df -h \.#;
>($total,$used) = $du =~ /([0-9]+(\.[ 0-9]+)?)[
> M|G]/sg
Inventor wrote:
While enthusiastically writing my new program, I was having so much
fun coding and reading www.perl.com articles that I didn't notice a
slow, creeping horror that was gradually building up on my machine.
Luckily I was reading about Apache and the log files when I remembered
that s
> -Original Message-
> From: country [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 18, 2007 06:00
> To: beginners@perl.org
> Cc: [EMAIL PROTECTED]
> Subject: Combining Records From Multiple Files based on
> Common Key Values
>
> I have multiple CSV files (3 for this example) with
> i
--- Inventor <[EMAIL PROTECTED]> wrote:
> While enthusiastically writing my new program, I was
> having so much
> fun coding and reading www.perl.com articles that I
> didn't notice a
> slow, creeping horror that was gradually building up
> on my machine.
> Luckily I was reading about Apache and
Hrm,
I am confused then:)
I have this as a file I am using right now!
while () {
my @data = split;
next unless @data == 3;
next if grep (/[^0-9.-]/, @data);
printf FILEOUT "X%s Y%s\n", $data[0], $data[1];
printf FILEOUT "G01 Z[%s+DPad] F[PFRate]\n", $data[2]
Inventor wrote:
[snip Apache tragedy]
My program accesses small text configuration files, allowing the user
to change them with a CGI interface before writing them out and doing
its compute thing. The problem is that each user needs to have their
own set of configuration files so that the us
On Wednesday 18 July 2007 17:08, Joseph L. Casale wrote:
> Is that true?
> I use while loops and they cycle through each line without me keeping
> track? jlc
Yeah, it's true. Why would you want to keep track?
(you can BTW, look at perldoc perlvar for $.)
in my code, the 1st line is written into $
JeeBee wrote:
Because I'm trying to match this regular expression a lot of times, that
could very well be the point to improve. I can imagine this is the
slowest part of the script:
my $exp = "nan|-?inf|[0-9\.e\+\-]+";
my $stat_pat =
"(?:\\s+($exp))(?:\\s+($exp))" . # $1 number of samples,
--- Ayesha <[EMAIL PROTECTED]> wrote:
> Hi all
>
> I got started on Perl only today!
> I have a text file in which I need to read a line
> and the line after
> that. Like
>
> line1 and line2
> line2 and line3
> line3 and line4
>
> when I use while($line1 = ){
>$lin
On Wednesday 18 July 2007 06:16, Ayesha wrote:
> Hi all
>
> I got started on Perl only today!
> I have a text file in which I need to read a line and the line after
> that. Like
>
> line1 and line2
> line2 and line3
> line3 and line4
>
> when I use while($line1 = ){
>$l
I have multiple CSV files (3 for this example) with
identical record layouts except that each Server Name may not be in
all of the files. Also the CSV files might not be sorted by Server
Name.
File A
Server Name,Avg CPU,P95 CPU,Avg Mem Util,P95 Mem Util
WSOMQAVPRA05,93.75,95.87,66.67,68.13
wsomdav
Hi,
su-2.05b# df -h .
Filesystem Size Used Avail Capacity Mounted on
/dev/ad0s1e 136G 102G 23G 82% /home
From my script I do:
my $du = qx#df -h \.#;
($total,$used) = $du =~ /([0-9]+(\.[ 0-9]+)?)[ M|G]/sg;
print "Total:$total\nUsed:$used\ n";
Hi all
I got started on Perl only today!
I have a text file in which I need to read a line and the line after
that. Like
line1 and line2
line2 and line3
line3 and line4
when I use while($line1 = ){
$line = ;
}
I get output
line1 and line2
line3 and l
While enthusiastically writing my new program, I was having so much
fun coding and reading www.perl.com articles that I didn't notice a
slow, creeping horror that was gradually building up on my machine.
Luckily I was reading about Apache and the log files when I remembered
that someone here advise
On 7/18/07, Paul Johnson <[EMAIL PROTECTED]> wrote:
snip
I see the following options:
- split your code into subroutines to gain a better understanding of
what is taking how much time
- install Devel::Cover and run
$ perl -MDevel::Cover ./analyze.pl traplas-example output
$ cover
Hi,
Perhaps you can use the /\G.../gc idiom and develop lex like engine.
see:
http://search.cpan.org/~nwclark/perl-5.8.8/pod/perlfaq6.pod#What_good_is_\G_in_a_regular_expression?_
and:
http://search.cpan.org/~nwclark/perl-5.8.8/pod/perlop.pod#Regexp_Quote-Like_Operators
>From my experience b
On Wed, Jul 18, 2007 at 03:29:51PM +0200, Paul Johnson wrote:
> - post your code so that other people can guess too
Sorry, I notice that you have already done this. When I first tried to
follow the link I had no success, but it works fine for me now.
I see I was right about no subroutines, so
On Wed, Jul 18, 2007 at 10:17:00AM +, JeeBee wrote:
> Thanks Paul, I should profile of course, should have thought about that.
>
> I tried the below, but it's not quite clear what this means to me.
> When I run with "./analyze.pl foo bar" the execution time is fast, so the
> problem is not s
Exactly, I actually wish to run 'yum' through Perl, but I want to give
(even) a non-sudoer the opportunity to authenticate for root and go
ahead with the install.
Tom Phoenix wrote:
On 7/17/07, Teresa Thomas <[EMAIL PROTECTED]> wrote:
But when I
try to execute commands that require user inpu
On Tue, 2007-07-17 at 16:40 +, [EMAIL PROTECTED] wrote:
> Hi, All:
> I am a new to perl. My perl code need to connect to the database in
> the remote server, and I can login that server via SSH. Can anyone
> give me a hint about how can I do that? Many thanks.
There is a proxy module that you
Thanks Paul, I should profile of course, should have thought about that.
I tried the below, but it's not quite clear what this means to me.
When I run with "./analyze.pl foo bar" the execution time is fast, so the
problem is not starting up/exiting of Perl, and I conclude it must be
inside the s
On Wed, Jul 18, 2007 at 09:49:24AM +, JeeBee wrote:
> Because I'm trying to match this regular expression a lot of times, that
> could very well be the point to improve. I can imagine this is the
> slowest part of the script:
Don't imagine. Profile. Then you'll know which parts of your pr
Because I'm trying to match this regular expression a lot of times, that
could very well be the point to improve. I can imagine this is the
slowest part of the script:
my $exp = "nan|-?inf|[0-9\.e\+\-]+";
my $stat_pat =
"(?:\\s+($exp))(?:\\s+($exp))" . # $1 number of samples, $2 minimum
"(
On Wed, Jul 18, 2007 at 02:20:15PM +0900, Jack Minoshima wrote:
> Hi.
> Please allow me to ask another silly question.
>
> I wrote the program and it works fine.
>
>
> Animal.pm
> package Animal;
> use Exporter;
> @ISA = qw(Expo
Dear Perl experts,
Some time ago I wrote a Perl script that combines the output values of a
lot of simulation runs. Because there are so many, I could some quite some
time if the script would run a bit faster. (I have the feeling it is
quite slow like it is).
Perhaps somebody has a tip to make
On 07/18/2007 12:13 AM, Jack Minoshima wrote:
[...]
Please tell my why I need quote after use base while using strict subs.
Thank you very much in advance !
-- jackm
The first explanation is that the module's documentation suggests that
the quotes are required.
The second quick explanation
58 matches
Mail list logo