Re: cmdline program to access s.m.a.r.t. data

2006-09-22 Thread reader
"joseph" <[EMAIL PROTECTED]> writes: > "Corey Hickey" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> [EMAIL PROTECTED] wrote: >>> Anyone know from experience of a commandline oriented program that can >>> access S.M.A.R.T. data? In particular hard drive temperature. >>> >>> Thi

Re: getting columns of 2D array

2006-09-22 Thread Bryan R Harris
> Aditi Gupta wrote: >> Hello Everybody, > > Hello, > >> We can get rows of a 2D array as >> >> $aref = $AoA[$i]; >> print @$aref; #will print row 'i' as an array >> >> How can I print column 'i' as an array using references? Is there any >> other way which doesn't require two 'for loops' to

Re: getting columns of 2D array

2006-09-22 Thread John W. Krahn
Aditi Gupta wrote: > Hello Everybody, Hello, > We can get rows of a 2D array as > > $aref = $AoA[$i]; > print @$aref; #will print row 'i' as an array > > How can I print column 'i' as an array using references? Is there any > other way which doesn't require two 'for loops' to print the columns?

Re: cmdline program to access s.m.a.r.t. data

2006-09-22 Thread joseph
"Corey Hickey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] wrote: >> Anyone know from experience of a commandline oriented program that can >> access S.M.A.R.T. data? In particular hard drive temperature. >> >> This would be a monitor tool for windowsxp machin

getting columns of 2D array

2006-09-22 Thread Aditi Gupta
Hello Everybody, We can get rows of a 2D array as $aref = $AoA[$i]; print @$aref; #will print row 'i' as an array How can I print column 'i' as an array using references? Is there any other way which doesn't require two 'for loops' to print the columns? Thanks in advance, Aditi -- To unsubscr

Re: cmdline program to access s.m.a.r.t. data

2006-09-22 Thread Corey Hickey
[EMAIL PROTECTED] wrote: Anyone know from experience of a commandline oriented program that can access S.M.A.R.T. data? In particular hard drive temperature. This would be a monitor tool for windowsxp machines. I've never tried it on anything other than Linux, but smartmontools lists Windows

Re: problem with stat?

2006-09-22 Thread John W. Krahn
Mathew wrote: > John W. Krahn wrote: >>Dr.Ruud wrote: >> >>>You can write >>> >>> !/^\.$|^\.\.$/ >>> >>>as >>> >>> !/^\.\.?$/ >>> >>>so also as >>> >>> !/^[.][.]?$/ >>Until Perl 5.8.10 comes along literals are more efficient than character >>classes so the first one would be better. > > I had t

cmdline program to access s.m.a.r.t. data

2006-09-22 Thread reader
Anyone know from experience of a commandline oriented program that can access S.M.A.R.T. data? In particular hard drive temperature. This would be a monitor tool for windowsxp machines. There appears to be a number of Temperature monitoring tools on the internet but what I'm looking for is one I

Re: AUTOLOAD in perltoot

2006-09-22 Thread Mumia W.
On 09/22/2006 08:30 AM, chen li wrote: Hi all, I copy some codes from perltoot and write some lines to see how AUTOLOAD works. test.pl #!C:/Perl/bin/perl.exe use strict; use warnings; use Data::Dumper; use Person; my $obj=Person->new(); print $obj->name(); p

Re: about perltoot

2006-09-22 Thread Mumia W.
On 09/22/2006 07:50 AM, chen li wrote: --- "Mumia W." <[EMAIL PROTECTED]> wrote: That "redundancy" allows you to use inheritance. If you have a class Employee, with an expanded set of fields, this method makes it possible to add the fields without having to modify each method that uses them.

Re: problem with stat?

2006-09-22 Thread Mathew
John W. Krahn wrote: > Dr.Ruud wrote: >> The '.' and '..' are directories, not plain files. > > Some file systems do not have the directories '.' and '..' so they *could* > just be plain files. > > >> You can write >> >> !/^\.$|^\.\.$/ >> >> as >> >> !/^\.\.?$/ >> >> so also as >> >> !/^[.

Re: problem with stat?

2006-09-22 Thread Mathew
Dr.Ruud wrote: > Thomas Bätzler schreef: > >> [ !/^\.$|^\.\.$/ and !/^\.\.?$/ ] >> I'm assuming that this regex would be faster, too, since it >> does not contain an alternation. > > That is hard to say without actual benchmarking: the regex-optimizer > gets better with every new version of per

Re: RANSAC method code for perl?

2006-09-22 Thread Saurabh Singhvi
Hi Fred, Right now, something else has taken first priority, so I will be writing this code later on. I'll post here and on CPAN :) regards Saurabh On 9/22/06, hOURS <[EMAIL PROTECTED]> wrote: Hello Saurabh, Did you ever find this? Because I'd be interested as well. Thanks, Fred Kittelmann

AUTOLOAD in perltoot

2006-09-22 Thread chen li
Hi all, I copy some codes from perltoot and write some lines to see how AUTOLOAD works. test.pl #!C:/Perl/bin/perl.exe use strict; use warnings; use Data::Dumper; use Person; my $obj=Person->new(); print $obj->name(); print Dumper $obj; # Person.pm in the s

Re: about perltoot

2006-09-22 Thread chen li
--- "Mumia W." <[EMAIL PROTECTED]> wrote: > On 09/21/2006 07:08 PM, chen li wrote: > > Hi all, > > > > I read some sections in perltoot. In section > > Autoloaded Data Methods I see some line codes as > > following: > > > > package Person; > > use Carp; > > our $AUTOLOAD; # i

Re: problem with stat?

2006-09-22 Thread Dr.Ruud
Thomas Bätzler schreef: > [ !/^\.$|^\.\.$/ and !/^\.\.?$/ ] > I'm assuming that this regex would be faster, too, since it > does not contain an alternation. That is hard to say without actual benchmarking: the regex-optimizer gets better with every new version of perl. Check also the re=debug

Re: problem with stat?

2006-09-22 Thread Dr.Ruud
"John W. Krahn" schreef: > Dr.Ruud: >> The '.' and '..' are directories, not plain files. > > Some file systems do not have the directories '.' and '..' so they > *could* just be plain files. Right, and that is one of the reasons why I keep bringing -f() up. I am also testing with a file called

Re: problem with stat?

2006-09-22 Thread John W. Krahn
Dr.Ruud wrote: > > The '.' and '..' are directories, not plain files. Some file systems do not have the directories '.' and '..' so they *could* just be plain files. > You can write > > !/^\.$|^\.\.$/ > > as > > !/^\.\.?$/ > > so also as > > !/^[.][.]?$/ Until Perl 5.8.10 comes alon

RE: URL need not do enciding

2006-09-22 Thread Lee Goddard
> I have a String which I am forming inside a variable. Say > > my > $urlString="http://www.yahoo.com/mail?username=anishkumar_k&us > erid=1234.0&companyname=abc". > > I am printing this string in a browser through CGI. In that case > > I am getting the URL with encoded characters for = say now

Re: problem with stat?

2006-09-22 Thread Dr.Ruud
Mathew Snyder schreef: > Dr.Ruud: >>my @filenames = grep -f "$dir/$_", sort readdir DH; > > Interesting. The above line returns 1648 items while the following > > @filenames = sort grep { !/^\.$|^\.\.$/ } readdir $dh; > > returns 1650. That would mean that there are 2 other "no-plain-files"

RE: problem with stat?

2006-09-22 Thread Thomas Bätzler
Mathew Snyder <[EMAIL PROTECTED]> wrote: > Did a bit o' Googling and found how to use the 'not' operator > and now have this line that eliminates the . and .. while > still populating the array in as few lines as possible: > > @filenames = sort grep { !/^\.$|^\.\.$/ } readdir $dh; You can optim

Re: problem with stat?

2006-09-22 Thread Dr.Ruud
Mathew Snyder schreef: > Did a bit o' Googling and found how to use the 'not' operator and now > have this line that eliminates the . and .. while still populating the > array in as few lines as possible: > > @filenames = sort grep { !/^\.$|^\.\.$/ } readdir $dh; Yes, but that still doesn't filte

Re: problem with stat?

2006-09-22 Thread John W. Krahn
Dr.Ruud wrote: > "Dr.Ruud" schreef: >>Mathew Snyder: > >>>foreach my $file (sort(readdir DH)){ >>>push @filenames, $file; >>>} >>You sort too early. > > Ignore that. Just use John's alternative: > > my @filenames = sort readdir DH; > > or make that > > my @filenames = sort grep -f,

Re: problem with stat?

2006-09-22 Thread Mathew Snyder
Dr.Ruud wrote: > Mathew Snyder schreef: >> Dr.Ruud: > >>> my @filenames = sort grep -f, readdir DH; >> I tried this line using $dh. Nothing was getting placed in the array. >> Would that be because everything in /usr/bin is an executable file? > > Aaargh no, I am making the same mistake as you

Re: problem with stat?

2006-09-22 Thread Dr.Ruud
Mathew Snyder schreef: > Dr.Ruud: >> my @filenames = sort grep -f, readdir DH; > > I tried this line using $dh. Nothing was getting placed in the array. > Would that be because everything in /usr/bin is an executable file? Aaargh no, I am making the same mistake as you did: not prepending the

Re: problem with stat?

2006-09-22 Thread Mathew Snyder
Dr.Ruud wrote: > "Dr.Ruud" schreef: >> Mathew Snyder: > >>> foreach my $file (sort(readdir DH)){ >>> push @filenames, $file; >>> } >> You sort too early. > > Ignore that. Just use John's alternative: > > my @filenames = sort readdir DH; > > or make that > > my @filenames = sort gre

Re: URL need not do enciding

2006-09-22 Thread John W. Krahn
Anish Kumar K. wrote: > Hi Hello, > I have a String which I am forming inside a variable. Say > > my > $urlString="http://www.yahoo.com/mail?username=anishkumar_k&userid=1234.0&companyname=abc";. > > > I am printing this string in a browser through CGI. In that case > > I am getting the URL w

Re: Question on the "Camel" book

2006-09-22 Thread Dr.Ruud
"John W. Krahn" schreef: > Dr.Ruud: >> Mathew Snyder: >>> John W. Krahn: Yes, Perl has five "false" values: undef, (), 0, '' and '0', and two of those are valid input from the readline operator. >>> >>> Should running the above from the command line make a difference? I >>> ran them bot

Re: problem with stat?

2006-09-22 Thread Mathew Snyder
Dr.Ruud wrote: > "Dr.Ruud" schreef: >> Mathew Snyder: > >>> foreach my $file (sort(readdir DH)){ >>> push @filenames, $file; >>> } >> You sort too early. > > Ignore that. Just use John's alternative: > > my @filenames = sort readdir DH; > > or make that > > my @filenames = sort gre

Re: problem with stat?

2006-09-22 Thread Dr.Ruud
Mathew Snyder schreef: > I [...] > removed the initialization to 0 for 'my > $file_count' since it doesn't need to be set to an initial value > anyway. There was nothing wrong with that initialization, but it is OK too to leave it out. But: you don't really need that $file_count, do you? The leng

Re: problem with stat?

2006-09-22 Thread Dr.Ruud
"Dr.Ruud" schreef: > Mathew Snyder: >> foreach my $file (sort(readdir DH)){ >> push @filenames, $file; >> } > > You sort too early. Ignore that. Just use John's alternative: my @filenames = sort readdir DH; or make that my @filenames = sort grep -f, readdir DH; Globs are sorted no

Re: problem with stat?

2006-09-22 Thread Mathew Snyder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 John W. Krahn wrote: > Mathew Snyder wrote: >> John W. Krahn wrote: > my @filenames; > my $processDir = "/usr/bin"; > > opendir DH, $processDir or die "cannot open $processDir: $!"; > foreach my $file (sort(readdir DH)){ >

URL need not do enciding

2006-09-22 Thread Anish Kumar K.
Hi I have a String which I am forming inside a variable. Say my $urlString="http://www.yahoo.com/mail?username=anishkumar_k&userid=1234.0&companyname=abc";. I am printing this string in a browser through CGI. In that case I am getting the URL with encoded characters for = say now it looks li

Re: problem with stat?

2006-09-22 Thread Dr.Ruud
Mathew Snyder schreef: > John W. Krahn: >> Mathew: >>> #!/usr/bin/perl -w >>> >>> use strict; >>> >>> my @filenames; >>> my $processDir = "/usr/bin"; >>> >>> opendir DH, $processDir or die "cannot open $processDir: $!"; >>> foreach my $file (sort(readdir DH)){ >>> push @filenames, $file; >

Re: problem with stat?

2006-09-22 Thread John W. Krahn
Mathew Snyder wrote: > John W. Krahn wrote: my @filenames; my $processDir = "/usr/bin"; opendir DH, $processDir or die "cannot open $processDir: $!"; foreach my $file (sort(readdir DH)){ push @filenames, $file; } >>>Why not just: >>> >>>my @filenames = sort

Re: problem with stat?

2006-09-22 Thread Mathew Snyder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dr.Ruud wrote: > Mathew Snyder schreef: > >> foreach my $file (sort(readdir DH)){ >> next if ($file =~ /^.%|^..$/); >> my $mod_time = (stat($file))[9]; >> $filenames{$file} = $mod_time; >> } > > No need to sort before you put

Re: Question on the "Camel" book

2006-09-22 Thread John W. Krahn
Dr.Ruud wrote: > Mathew Snyder schreef: >>John W. Krahn: > >>>Yes, Perl has five "false" values: undef, (), 0, '' and '0', and two >>>of those are valid input from the readline operator. >>Should running the above from the command line make a difference? I >>ran them both entering 0 each time and

Re: problem with stat?

2006-09-22 Thread Dr.Ruud
Mathew Snyder schreef: > foreach my $file (sort(readdir DH)){ > next if ($file =~ /^.%|^..$/); > my $mod_time = (stat($file))[9]; > $filenames{$file} = $mod_time; > } No need to sort before you put things in a hash: hashes don't keep order. Try this: my %file_modtime

Re: problem with stat?

2006-09-22 Thread Mathew Snyder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 John W. Krahn wrote: >> #!/usr/bin/perl -w >> >> use strict; >> >> my @filenames; >> my $processDir = "/usr/bin"; >> >> opendir DH, $processDir or die "cannot open $processDir: $!"; >> foreach my $file (sort(readdir DH)){ >> push @filenames, $f

Re: problem with stat?

2006-09-22 Thread Mumia W.
On 09/22/2006 02:58 AM, Mathew Snyder wrote: [...] my $mod_time = (stat($file))[9]; [...] If $file is not in the current directory, this won't work. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: problem with stat?

2006-09-22 Thread Dr.Ruud
"Dr.Ruud" schreef: > Mathew Snyder: >> #!/usr/bin/perl -w >> >> use strict; > > I would change that to: > > #!/usr/bin/perl -w > use warnings ; > use strict ; Oops, the whole point of that was to remove the "-w". See `perldoc perllexwarn`. -- Affijn, Ruud (now you'll remember even better)

Re: Question on the "Camel" book

2006-09-22 Thread Dr.Ruud
Mathew Snyder schreef: > Dr.Ruud: >> flotsan: >>> it is told the following two statements are >>> different: >>> >>> 1) if ($_ = ) { print; } # suboptimal: doesn't test defined >>> 2) if (defined($_ = )) { print; } # best >>> >>> But as I see it, these two do the same thing >> >> perl -le ' >

Re: Question on the "Camel" book

2006-09-22 Thread Dr.Ruud
Mathew Snyder schreef: > John W. Krahn: >> Yes, Perl has five "false" values: undef, (), 0, '' and '0', and two >> of those are valid input from the readline operator. > > Should running the above from the command line make a difference? I > ran them both entering 0 each time and I got 0 back. T

Re: Question on the "Camel" book

2006-09-22 Thread flotsan
Thanks... Now I see the one with "defined" test deals better with those possible "false" "false" inputs:-) flotsan ""John W. Krahn"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Mathew Snyder wrote: >> John W. Krahn wrote: Yes, Perl has five "false" values: undef, (), 0, ''

Re: problem with stat?

2006-09-22 Thread Dr.Ruud
Mathew Snyder schreef: > #!/usr/bin/perl -w > > use strict; I would change that to: #!/usr/bin/perl -w use warnings ; use strict ; > my @filenames; > my $processDir = "/usr/bin"; > > opendir DH, $processDir or die "cannot open $processDir: $!"; > foreach my $file (sort(readdir DH)){ >

Re: Question on the "Camel" book

2006-09-22 Thread Mathew Snyder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 John W. Krahn wrote: > Mathew Snyder wrote: >> John W. Krahn wrote: Yes, Perl has five "false" values: undef, (), 0, '' and '0', and two of those are valid input from the readline operator. >> Should running the above from the command l

Re: Question on the "Camel" book

2006-09-22 Thread John W. Krahn
Mathew Snyder wrote: > John W. Krahn wrote: >>>Yes, Perl has five "false" values: undef, (), 0, '' and '0', and two of those >>>are valid input from the readline operator. > > Should running the above from the command line make a difference? I ran > them both entering 0 each time and I got 0 back

Re: Proper output

2006-09-22 Thread John W. Krahn
Sayed, Irfan (Irfan) wrote: > Hi All, Hello, > I am not getting the proper output in @vob_rep Array. What is it doing that you don't want it to do? What is it not doing? John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EM

Re: problem with stat?

2006-09-22 Thread Mathew Snyder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Updated my code to look like this: #!/usr/bin/perl -w use strict; my %filenames; my $file_count = 0; my $processDir = "/usr/bin"; opendir DH, $processDir or die "cannot open $processDir: $!"; foreach my $file (sort(readdir DH)){ next if ($f

Re: problem with stat?

2006-09-22 Thread John W. Krahn
Mathew Snyder wrote: > I'm trying to figure out how to use stat. I have the following code: You should really figure out how to use readdir perldoc -f readdir > #!/usr/bin/perl -w > > use strict; > > my @filenames; > my $processDir = "/usr/bin"; > > opendir DH, $processDir or die "cannot op

RE: Date and Time Functions

2006-09-22 Thread Lee Goddard
Xavier Mas i Ramón [mailto:[EMAIL PROTECTED] : > A Dijous 21 Setembre 2006 01:38, [EMAIL PROTECTED] va escriure: > > > I am looking for some simple perl functions that will return the > > current date and time in string format. The purpose is to create a > > file with part of the name being the d

Re: about perltoot

2006-09-22 Thread Mumia W.
On 09/21/2006 07:08 PM, chen li wrote: Hi all, I read some sections in perltoot. In section Autoloaded Data Methods I see some line codes as following: package Person; use Carp; our $AUTOLOAD; # it's a package global my %fields = ( name=> undef,

Proper output

2006-09-22 Thread Sayed, Irfan \(Irfan\)
Hi All, I am not getting the proper output in @vob_rep Array. Following is my code # Perl script to change the replica name use strict; use warnings; my $fname = "/tmp/vob_list1"; open FILE,">",$fname or die $!; my $fname1 = "/tmp/repl_list1"; open FILE1,">",$fname1 or die $!; my $CT = '

Re: problem with stat?

2006-09-22 Thread Mathew Snyder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mathew Snyder wrote: > I'm trying to figure out how to use stat. I have the following code: > > #!/usr/bin/perl -w > > use strict; > > my @filenames; > my $processDir = "/usr/bin"; > > opendir DH, $processDir or die "cannot open $processDir: $!";

problem with stat?

2006-09-22 Thread Mathew Snyder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm trying to figure out how to use stat. I have the following code: #!/usr/bin/perl -w use strict; my @filenames; my $processDir = "/usr/bin"; opendir DH, $processDir or die "cannot open $processDir: $!"; foreach my $file (sort(readdir DH)){