Help - Search - Member List - Calendar
Full Version: combinations
WorkTheWeb Forums > Webmaster Resources > Perl Beginner Help
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
Support our Sponsors!
Silverfox
David Storrs wrote:

QUOTE
On Mon, Aug 11, 2003 at 09:42:40AM -0400, Stephen Gilbert wrote:
-----Original Message-----
From: SilverFox [mailto:[Email Removed]]
Sent: Sunday, August 10, 2003 4:58 PM
To: [Email Removed]
Subject: Net::Telnet


hey anyone know how to check if a file exists using the Telnet module?

--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

try:
$file_exists = $t->cmd("perl -e 'print 1 if (-s "file")'") or warn
"Unable to execute command: $!n"; if ($file_exists) {
# do whatever
}

'if (-s)' will actually check that the file has non-zero size (-s
returns the size; if the size if 0, it is false).

If you simply want to know whether it exists, but you don't care what
size it is, then use -e.


--Dks


You guys are the best...thx

Bernhard Van Staveren
Localtime takes it's input either from the time() function if you call it
without parameters, or from a timestamp you supply. So, if I wanted the
current date and time, but 10 minutes into the future I'd do:

my $mydate=localtime( time() + 600 );

(600 seconds being 10 minutes, added to the current time).

--
Bernhard van Staveren - madcat(at)ghostfield.com
GhostField Internet - http://www.ghostfield.com/
"A witty saying proves nothing, but damn it's funny!" - me, 1998

Silverfox
Jeff 'Japhy' Pinyan wrote:

QUOTE
On Aug 17, SilverFox said:

Hi all...how can I pull the number from the given path??

/Machine4/dir/dir/dir

Well, it's a little vague, but perhaps all you want is

my ($num) = $path =~ /(d+)/;

Or perhaps

my ($num) = $path =~ /Machine(d+)/;

Cool...that did the trick


Marcos Rebelo
the eseast way is having all the arrays in a hash.

map{$hash{$_}->[$index]="xxxx" if /^xyz/}(keys(%hash));

-----Original Message-----
From: T.S.Ravi Shankar [mailto:[Email Removed]]
Sent: Monday, August 18, 2003 8:51 AM
To: [Email Removed]
Cc: Ravi
Subject: get all the arrays with names starting with xyz


Hi all :

I have few arrays with names starting with "xyz_". After the initial
definitions I want to change values of a particular index of all arrays
whose names start with "xyz_". It would be cumbersome for me to do
something like :

$xyz_blahblah[$index] = "ldfhdlf";
$xyz_blooblooh[$index] = "dfhdlkfhdkf";
$xyz_foofoo[$index] = 27;
....

...


& so on...

particularly when the number of arrays are many !!


Is there any method to do this easily ?? Or could I get the names of all
arrays with a particular starting string & then group them in a array
and proceed ??

Thanks in advance !!

Regards,
Ravi



--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

Tassilo Von Parseval
On Mon, Aug 18, 2003 at 07:34:41AM -0400 Kipp, James wrote:

QUOTE
I have a file cointaing 1024  hex  numbers .
I want to convert them to Bin.
Please help

try something like this:

$hex = 0xff;
$bin = unpack("B32", pack("N", hex $hex));

The above assumes big-endian byteorder. For little-endian use "V" instead
of "N". Or just use "L" when the file has the same byteorder as the
machine you are running this script on.

Btw, the hex() above is probably wrong. hex() converts a string into a
numeric value by intepreting it as hexadecimal. Essentially, you do it
twice resulting in:

$hex = 0xff == 255 => hex(255) == 597

Whereas:

$hex = "0xff" => hex($hex) == 255

Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.t$&."'!#+sexisexiixesixeseg;y~n~~dddd;eval

James Kipp
QUOTE

$hex = 0xff;
$bin = unpack("B32", pack("N", hex $hex));

The above assumes big-endian byteorder. For little-endian use
"V" instead
of "N". Or just use "L" when the file has the same byteorder as the
machine you are running this script on.

Btw, the hex() above is probably wrong. hex() converts a string into a
numeric value by intepreting it as hexadecimal. Essentially, you do it
twice resulting in:

woops, you are correct. the 'hex $hex' assumes it is passed as a string.
other than that it works as expected on both my Win2k (intel, little endian)
and Solaris (sparc, big endian). The bin result is returned in big endian on
both machines, so one would have to be cognizant that the result is not
returned in the native format for little endian machines. And yes it depends
on how the file is formatted. so we can make some adjustments:

--
$hex = '0xff'; #passed as a string
$bin = unpack("B32", pack("N", hex $hex));
print $bin;

---
$hex = 0xff;
$bin = unpack("B32", pack("N", $hex)); #passed as a hex number
print $bin;

----
# print in correct order for little endian machines
$hex = '0xff';
$bin = unpack("B32", pack("L", hex $hex));
print $bin;

-----

Thanks Tassilo !

Dan Muey
QUOTE
Hi Dan,

I don't think that is actually what he is asking for.Unless I
misunderstand, he is referring to a pass-through program.  Of

That's why I asked what he meant. The absolut simpleest would be:

#!/usr/bin/perl -w

use strict;
use CGI qw(header);
use File::Slurp;

pritn header();
print read_file("./index.html");

Pretty pointless unless you did something with the file:

my $file = read_file("./index.html");

$file =~ s/Joemama/Monkey/g;
print $file;

Now what I assumed he probably meant was:

print header();
if(whatever) { process formand output html results )
else { print formhtml }

Whatever.

Dan

QUOTE
course, a pure passthrough program would be pointless--it
would be quicker to serve the page up directly through a http
GET.  OTOH, if you have some simple insertion magic to do on
a template page, this is a very goo strategy, and one I use:

open (WEATHERPAGE, "Current_Vantage_Pro.htm") || die
("can't open source file");
my $CurrentLine = "";
while (!(($CurrentLine = <WEATHERPAGE>) =~ /head/i)) {;}
# the head section is sent elsewhere, as is the CGI header
while (!(($CurrentLine = <WEATHERPAGE>) =~ //table/i)) {
print "$CurrentLine";
}
print "$CurrentLine";
if (my $Test = GetConditions ($contents)) {
InsertWarning ($contents);
}
while ($CurrentLine = <WEATHERPAGE>) {
print "$CurrentLine";
}
close WEATHERPAGE;
}

Of course this presumes that either:

The source file has the CGI Content-type header, or that the
program has already sent it.  Once the proper header is sent,
it is perfectly easy to pass through a local file.

As to style, this was one of my ealry scripts.  I now use
choo_choo_train rather than CamelBack for identifiers other
than class names.  May have to do some "Replace All" magic on
my work from this period..

Joseph



------------------------------------------------
On Sun, 17 Aug 2003 19:26:53 +0200, Bjrn_Brombach <[Email Removed]> wrote:

QUOTE
I wanted to add some more details:
When i use this skript:

my $supported = Net::SSH::Perl::Cipher::supported();
for my $cipher (sort @$supported) {
printf "    [%d] %sn", $ciph, Net::SSH::Perl::Cipher::name($cipher);
}

I get only [5] RC4 as a result. So maybe thats why i always get that not
supported cipher type message when trying to use des or 3des.
Where could i change or add the supported cipher types?
And still makes me wonder as the shell ssh command works fine and all cipher
types are supported. Am i missing a module?


Net::SSH::Perl relies on a number of modules for the different cipher types, DES as well. The local SSH client has nothing to do with the module as it handles the whole process internally rather than shelling out or using an external client. If it is telling you all you have available is RC4 then that is probably correct and you need to install the other modules.

If my records are correct you should only need Crypt::DES to add DES support. You might try installing using CPAN rather than the SUSE package (if that is how you installed it) so that you are prompted for the compatibilities you want in Net::SSH::Perl and to make sure the dependencies are satisfied as there are a lot of them (if you installed from CPAN did it not prompt you?). I will attach the dependency chart I generated before (though it may not be complete, for all ciphers, etc.) (There is also a bug in Math::PARI/pari if you have a long running application that causes a memory leak that generates weird results - it takes about 2 hours to generate running about 30 commands every minute)

Does this help?

http://danconia.org

Dependency list:

- Net::SSH::Perl (requires
- Digest::HMAC_MD5 (requires Digest::MD5, Digest::SHA1)
- Digest::MD5 (requires N/A)
- Digest::SHA1 (requires N/A)
- Crypt::DSA (requires Crypt::Random, Math::Pari, Digest::SHA1, prefers Data::Buffer
for (ssh2))
- Crypt::Random (requires Math::Pari, Class::Loader)
- Class::Loader (requires N/A)
- Math::Pari (requires pari C libraries)
- Math::Pari (requires pari C libraries)
- Digest::SHA1 (requires N/A)
- Data::Buffer (requires N/A)
- Crypt::RSA (requires Digest::MD2, Convert::ASCII::Armour, Crypt::Primes, Tie::EncryptedHash, Crypt::Blowfish, Sort::Versions)
- Digest::MD2 (requires N/A)
- Convert::ASCII::Armour (requires Digest::MD5, Compress::Zlib)
- Digest::MD5 (requires N/A)
- Compress::Zlib (requires N/A)
- Crypt::Primes (requires Crypt::Random, Math::Pari)
- Crypt::Random (requires Math::Pari, Class::Loader)
- Class::Loader (requires N/A)
- Math::Pari (requires pari C libraries)
- Math::Pari (requires pari C libraries)
- Tie::EncryptedHash (requires Crypt::Blowfish, Crypt::CBC, Crypt::DES)
- Crypt::Blowfish (requires N/A)
- Crypt::CBC (requires Digest::MD5, Crypt::Rijndael)
- Digest::MD5 (requires N/A)
- Crypt::Rijndael (requires N/A)
- Crypt::DES (requires N/A, prefers Crypt::CBC)
- Crypt::CBC (requires Digest::MD5, Crypt::Rijndael)
- Digest::MD5 (requires N/A)
- Crypt::Rijndael (requires N/A)
- Crypt::Blowfish (requires N/A)
- Sort::Versions (requires N/A)
- Convert::PEM (requires Digest::MD5, Convert::ASN1, Crypt::DES_EDE3)
- Digest::MD5 (requires N/A)
- Convert::ASN1 (requires N/A)
- Crypt::DES_EDE3 (requires Crypt::DES)
- Crypt::DES (requires N/A, prefers Crypt::CBC)
- Crypt::CBC (requires Digest::MD5, Crypt::Rijndael)
- Digest::MD5 (requires N/A)
- Crypt::Rijndael (requires N/A)
- Crypt::DH (requires Crypt::Random, Math::Pari)
- Crypt::Random (requires Math::Pari, Class::Loader)
- Class::Loader (requires N/A)
- Math::Pari (requires pari C libraries)
- Math::Pari (requires pari C libraries)
- Math::Pari (requires pari C libraries)
- Crypt::DES (requires N/A, prefers Crypt::CBC)
- Digest::SHA1 (requires N/A)
? Math::GMP (requires gmp C libraries) (ssh1 only)



QUOTE
Furthermore i wanted to add the debug output:

server: Reading configuration data /root/.ssh/config
server: Reading configuration data /etc/ssh_config
server: Allocated local port 1023.
server: Connecting to 192.168.30.4, port 22.
server: Remote protocol version 1.99, remote software version OpenSSH_3.5p1
server: Net::SSH::Perl Version 1.23, protocol version 1.5.
server: No compat match: OpenSSH_3.5p1.
server: Connection established.
server: Waiting for server public key.
server: Received server public key (768 bits) and host key (1024 bits).
server: Host '192.168.30.4' is known and matches the host key.
Selected cipher type des not supported by server. at ./test.pl line 14

Thanks
-bb

-----Ursprngliche Nachricht-----
Von: Bjrn Brombach [mailto:[Email Removed]]
Gesendet: Sonntag, 17. August 2003 18:22
An: perl
Betreff: SSH Problem


Hi,
I have installed SuSE 8.2, perl-Net-SSH-Perl-1.23, String-CRC32-1.2.
I am trying to make an SSH connection to a remote SuSe 8.2 computer.
And the perl skript is where i am having the problem. Trying to use it
produces the following error:
"selected cipher type DES not supported by server."

I tried 3DES as well, same error.
This is what i used:

# !/usr/bin/perl
use Net::SSH::Perl;

$host="host";
$passwd="passwd";
$user="user";

my $ssh=Met::SSH::Perl->new($host);
my $ssh=Net::SSH::Perl->new($host,cipher=>'DES');
$ssh->login($user,$passwd);
$ssh->cmd("who");

When i use >ssh -c des -l user ip_add from the command prompt the connection
to the other Linux boxes works perfect. So i dont understand where the error
is.
I hope someone has a clue or can point me to a link where i can get further
help.

Thanks for any replies
-bb


James Edward Gray II
On Monday, August 18, 2003, at 10:29 AM, awards wrote:

QUOTE
Hi,

I have no idea how to do this.
I have a name
Anthony Bob
I want to put each letter in an array (no space)

my $name = 'Anthony Bob';
$name =~ tr/ //d; # remove the space
my @letters = split //, $name;

QUOTE
for(0..$numbersofletters){
@letters[c]= A LETTER
}
so when i do print @letters i get

print "$_n" foreach @letters;

Hope that helps.

James

QUOTE
A
N
T
H
O
N
Y
B
O
B
something like that, any help is appreciated.
Anthony



--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]


Awards
Hi,

That is quite simple. I tought it would be more difficult than that :-)

Thank you both of you
Anthony

Dan Muey
QUOTE
Hi,

Howdy
QUOTE

That is quite simple. I tought it would be more difficult
than that :-)


It's cuz Perl rocks!!

QUOTE
Thank you both of you
Anthony



--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]



Rob Hanson
Just to throw out another idea, you can also do this...

my $name = "Anthony Bob";
my @letters = grep {!/s/} split('', $name);

# to test
print "@letters";

It also looks like you wanted upper case. You can do that with this...

my $name = "Anthony Bob";
my @letters = grep {!/s/} split('', uc($name));

In both cases the split cuts it up into a list of characters, and grep
filters out the spaces (also newlines & tabs).

Rob


-----Original Message-----
From: awards [mailto:[Email Removed]]
Sent: Monday, August 18, 2003 11:30 AM
To: [Email Removed]
Subject: need help decompose word


Hi,

I have no idea how to do this.
I have a name
Anthony Bob
I want to put each letter in an array (no space)
for(0..$numbersofletters){
@letters[c]= A LETTER
}
so when i do print @letters i get
A
N
T
H
O
N
Y
B
O
B
something like that, any help is appreciated.
Anthony



--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

Rob Hanson
Like this...

$string="1
blabla";

my @lines = split("n", $string);

# testing...
print "1: $lines[0]n";
print "2: $lines[1]n";

See perldoc -f split if you want more info on the command.

Rob

-----Original Message-----
From: Pablo Fischer [mailto:[Email Removed]]
Sent: Monday, August 18, 2003 11:58 AM
To: [Email Removed]
Subject: Split NewLines


Hi!

I have in $string something like:

$string="1
blabla";

When Im printing $string I get a new line between 1 and blabla, now I needt
o
split that.. in

my($number, $real_string) = split...

How can I split it?

Thanks!
Pd. Its a scalar variable
Pablo
--
Pablo Fischer Sandoval ([Email Removed])
http://www.pablo.com.mx
http://www.debianmexico.org
GPG FingerTip: 3D49 4CB8 8951 F2CA 8131 AF7C D1B9 1FB9 6B11 810C
Firma URL: http://www.pablo.com.mx/firmagpg.txt

--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

Bob Showalter
awards wrote:
QUOTE
Hi,

I have no idea how to do this.
I have a name
Anthony Bob
I want to put each letter in an array (no space)
for(0..$numbersofletters){
@letters[c]= A LETTER
}
so when i do print @letters i get
A
N
T
H
O
N
Y
B
O
B
something like that, any help is appreciated.
Anthony

Rather than using split and grep, you can use a capturing regex with /g in
list context to return a list of matches:

@letters = uc($word) =~ /([A-Z])/g;

David
T.S.Ravi Shankar wrote:

QUOTE
Hi all :

I have few arrays with names starting with "xyz_".  After the initial
definitions I want to change values of a particular index of all arrays
whose names start with "xyz_".  It would be cumbersome for me to do
something like :

$xyz_blahblah[$index] = "ldfhdlf";
$xyz_blooblooh[$index] = "dfhdlkfhdkf";
$xyz_foofoo[$index] = 27;

& so on...

particularly when the number of arrays are many !!


Is there any method to do this easily ?? Or could I get the names of all
arrays with a particular starting string & then group them in a array
and proceed ??


depends on how you declare (global or lexical), you might go to the symbol
table and ask for a certain type of variables (array, hash, scalar, etc)
and update their values. the following assumes that you declare your
variables as global with 'our' and update the third element (to have the
value of 99) of all arrays whose name begines with 'xyz':

#!/usr/bin/perl -w
use strict;

#--
#-- the following 3 arrays are declared with 'our' which makes
#-- them global and thus visible in the symbol table. the third
#-- element of those arrays will be updated to have the value of 99
#--
our @xyz_var1 = 1 .. 5;
our @xyz_var2 = 2 .. 6;
our @xyz_change_me = 12 .. 16;

#--
#-- the following is not updated:
#--
#-- @dont_change_me: because it doesn't start with xyz
#-- %xyz_dont_change_me: because it's a hash, not array
#-- $xyz_dont_change_me: because it's a sclar, not array
#-- @xzy_not_global: because it's declared with 'my' which makes it lexical
#--
our @dont_change_me = 7 .. 11;
our %xyz_dont_change_me = 50 .. 53;
our $xyz_dont_change_me = 100;
my @xzy_not_global = 17 .. 21;

#--
#-- this asks the symbol table for all globol variables declared so far
#-- and update the array's 3rd element to 99
#--
$::{$_}->[2] = 99 for(grep {/^xyz/} keys %::);

#--
#-- demo to show their values are indeed changed
#--
print join(" ",@xyz_var1),"n";
print join(" ",@xyz_var2),"n";
print join(" ",@xyz_change_me),"nn";

#--
#-- demo to show that this is not changed
#--
print join(" ",@dont_change_me),"n";
print join(" ",@xzy_not_global),"n";

__END__

prints:

1 2 99 4 5
2 3 99 5 6
12 13 99 15 16

7 8 9 10 11
17 18 19 20 21

generally, this is a poor approach especially if you are new to Perl. you
might accidentally change something that you are not intended to change.
other disadvantages include:

* it's slow because it walks the entire symbol table each time it's called.
you can improve this by caching the variables in a hash but you must be
careful that you don't declare more arrays after you cache them because the
cache version won't see those.

* it's dangerous because we might change something that you don't really
want to change. this is especially important if you are new to Perl.

* if your arrays are declared with 'my', they won't be changed at all.

david

John W. Krahn
Awards wrote:
QUOTE

Hi,

Hello,

QUOTE
I have no idea how to do this.
I have a name
Anthony Bob
I want to put each letter in an array (no space)
for(0..$numbersofletters){
@letters[c]= A LETTER
}
so when i do print @letters i get
A
N
T
H
O
N
Y
B
O
B
something like that, any help is appreciated.

my $text = ' Anthony Bob ';

my @letters = $text =~ /[[:alpha:]]/g;

print "$_n" for @letters;



John
--
use Perl;
program
fulfillment

Christopher X66156 McMahon
I'll take this a step further. Search Google for "de icaza .net".
Miguel de Icaza produced the GNOME desktop and founded Ximian/Mono. He's
quoted all over the place discussing what .NET has to offer beyond the MS
arena, for Open Source and wide interoperability. I think that de Icaza
explains .NET better than Microsoft has... at least from a developer's point
of view.
ActiveState has a Perl environment "Visual Perl" that seems to be
capable of interacting in a .NET sort of way with other .NET languages,
which is pretty cool.
.NET is worth investigating if for no other reason than that it
seems to be the MS answer to Sun's Java *and* IBM's WebSphere. And it has
a lot of room to grow.
I'm interested because I just got a job with an all-Windows shop
migrating apps from C++ to .NET. Except for Windows workstations and a
little bit of MS ODBC, all my professional experience has been on Tandem,
Solaris, and AIX. I hope .NET is as cool as de Icaza says it is, because
Windows kinda creeps me out. It's just very weird having all of that
abstraction/secret code between me and what the OS is doing.
-Chris


-----Original Message-----
From: [Email Removed] [mailto:[Email Removed]]
Sent: Monday, August 18, 2003 1:45 PM
To: Rich Parker; [Email Removed]
Subject: RE: New to list, question.



------------------------------------------------
On Mon, 18 Aug 2003 12:40:02 -0700, Rich Parker <[Email Removed]>
wrote:

QUOTE
Hi,
I've been involved with Perl for many years (too many to count right
now). One question has been bugging me lately, and maybe it's because I
don't know enough about it, or maybe it's because I've been "Not the
biggest fan" of Mr. Bill and his org... Either way, I'm attempting to
learn about .NET (Don't panic here, I'm just looking for some
information).

Mainly, how does, or can the .NET framework be of benefit to the Perl
developer at large? Am I going to get any "Bang for my buck" using Perl
in the .NET environment? But WAIT, I'm working on Linux Systems, how
does that effect what I am asking?? If someone could provide me a link
to some articles about .NET from many different perspectives, preferably
NOT by MS (If you catch my drift here). I want to see if this framework
is going to be something of use to me.

Thanks for ANY help you can provide.

You may want to check out the MONO project:

http://go-mono.org/

http://danconia.org

_
This message and any attachments are intended only for the use of the addressee and
may contain information that is privileged and confidential. If the reader of the
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.

Bob Showalter
John W. Krahn wrote:
QUOTE
...
my @letters = $text =~ /[[:alpha:]]/g;

I never knew you could leave the parens off in a case like this. I just went
and looked it up. Neat!

Bernhard Van Staveren
QUOTE
my $text = ' Anthony Bob ';

my @letters = $text =~ /[[:alpha:]]/g;

print "$_n" for @letters;

This works too (at least, works for me):

my $text='Anthony Bob';
my @letters=split(//, $text);
print(join("n", @letters));

--
Bernhard van Staveren - madcat(at)ghostfield.com
GhostField Internet - http://www.ghostfield.com/
"A witty saying proves nothing, but damn it's funny!" - me, 1998

Rich Parker
Very interesting reading, Thanks,
Actually, it "Could be" great reading to "Sleep by". But I have a
concern about all of this, be that a MS "Controlled" .NET or even an
"OPEN source" Mono. Who is going to "control" where all of this resides?
Let's take the MS idea of .NET for a moment, remember WHEN the Justice
dept tried to "Go after" MS because they had too much control of things?
Regardless of my personal opinions on this (Bill who?) doesn't this
whole idea give Mr. Gates more of the opportunity that IF anyone tries
"That" again, the HE could "Pull the plug" and everyone who is using
..NET now can't make their programs run? Isn't that a REAL possibility?
Or let's look at it from the OPEN Source side, if ALL of this "common
code" (For lack of a better word right now) was at one or a "Handful" of
sites, and let's just say there was a "Power outage" (Remember the great
power outage of 2003?), then what? The rest of us are still working, but
WE can't access the needed files to make our Internet or Intranet sites
work, so now we start having a cascade failure of the NET (No DOT here,
everyone). From a company perspective, the concept of .NET is wonderful,
as long as "Our source code" is just that, "OURS". But from the poor guy
who suddenly NOW has to pay MS (Back to .NET again) a monthly fee just
to OPEN a Word Doc, I don't see the public going for that. Do I have
this wrong? Don't tell me Mr. Gates is going to keep the basic modules
for MS-Word free for everyone?? Yea right. I'm just concerned, that's
all, I love the idea of "Every developer" getting his "Fair share" for
the bits & pieces he creates, and YES, we are NOT reusing our code
enough, but is THIS the correct solution??

Anyone got anymore links for me? I noticed that when I did that search
on the "de icaza .net" (without the quotes, duh?) that the TOP article
was on O'Reilly, I like their books, don't get me wrong, but will they
publish someone else's "Point of view", even though de Icaza seems like
a "Sharp cookie" and admittedly, this is this first time I've heard of
him. I'd like to hear what others have to say. I've been developing Perl
based web sites for a long time, what I've always liked about it was/is
the fact that it actually works and it's included with the O/S's like
Linux (Ok, use the word - FREE) and I just feel that if Bill gets His
way, that we'll all loose out on the word FREE. Now if this idea was
like a "Newsgroup" where the various news servers got reloaded from time
to time and the code wasn't just in ONE spot, I might be willing to
really support it, but the more I learn about this, the more questions I
have. Somebody HELP me understand why this is the NEXT thing in
software. I just don't get it.

Thanks.

McMahon, Christopher x66156 wrote:

QUOTE
I'll take this a step further.  Search Google for "de icaza .net".
Miguel de Icaza produced the GNOME desktop and founded Ximian/Mono.  He's
quoted all over the place discussing what .NET has to offer beyond the MS
arena, for Open Source and wide interoperability.  I think that de Icaza
explains .NET better than Microsoft has... at least from a developer's point
of view.
ActiveState has a Perl environment "Visual Perl" that seems to be
capable of interacting in a .NET sort of way with other .NET languages,
which is pretty cool.
.NET is worth investigating if for no other reason than that it
seems to be the MS answer to Sun's Java *and* IBM's WebSphere.  And it has
a lot of room to grow.
I'm interested because I just got a job with an all-Windows shop
migrating apps from C++ to .NET.  Except for Windows workstations and a
little bit of MS ODBC, all my professional experience has been on Tandem,
Solaris, and AIX.  I hope .NET is as cool as de Icaza says it is, because
Windows kinda creeps me out.  It's just very weird having all of that
abstraction/secret code between me and what the OS is doing.
-Chris


-----Original Message-----
From: [Email Removed] [mailto:[Email Removed]]
Sent: Monday, August 18, 2003 1:45 PM
To: Rich Parker; [Email Removed]
Subject: RE: New to list, question.



------------------------------------------------
On Mon, 18 Aug 2003 12:40:02 -0700, Rich Parker <[Email Removed]
wrote:


Hi,
I've been involved with Perl for many years (too many to count right
now). One question has been bugging me lately, and maybe it's because I
don't know enough about it, or maybe it's because I've been "Not the
biggest fan" of Mr. Bill and his org... Either way, I'm attempting to
learn about .NET (Don't panic here, I'm just looking for some

information).

Mainly, how does, or can the .NET framework be of benefit to the Perl
developer at large? Am I going to get any "Bang for my buck" using Perl
in the .NET environment? But WAIT, I'm working on Linux Systems, how
does that effect what I am asking?? If someone could provide me a link
to some articles about .NET from many different perspectives, preferably
NOT by MS (If you catch my drift here). I want to see if this framework
is going to be something of use to me.

Thanks for ANY help you can provide.


You may want to check out the MONO project:

http://go-mono.org/

http://danconia.org

_
This message and any attachments are intended only for the use of the addressee and
may contain information that is privileged and confidential. If the reader of the
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.


Ramprasad A Padmanabhan
Voodoo Raja wrote:

QUOTE
Sorry for not posting it in the first place.

Will this sub.. chew memory if I run it a number of times.. or does it
overwrite it.

sub read {
print "nreading data";
$db = DBI->connect("DBI:mysql:$dbase:$hostname", $username, $password);
$query = $db->prepare("SELECT * FROM cash where f1 = '1002'");
$query->execute;
$numrows = $query->rows;
while (@array = $query->fetchrow_array ) {
($field1, $field2, $field3, $field4, $field5, $field6, $field7,
$field8, $field9, $field10,
$field11, $field12, $field13, $field14, $field15, $field16, $field17,
$field18) = @array;}
$query->finish;
$db->disconnect;
print "nf1 is $field1";
$lasttrans = "$field1";
$newtrans = ($lasttrans+1);
}


this is the exact sub where I feel that I am doing something wrong..
Should this leave memory occupied if I run this loop a number of times
What happans if I runn this a number of times...

I am sorry if I cant explain it anybetter.. I am trying my best to
learn this. please take me as a very begginer..

Regards
Sam


From: Ramprasad A Padmanabhan <[Email Removed]
To: [Email Removed], Samuel Shankar <[Email Removed]
CC: [Email Removed]
Subject: Re: Display realtime data As it changes in the databse - TK
Date: Tue, 19 Aug 2003 11:32:33 +0530

Samuel Shankar wrote:

Hi List

I was wandering if someone can help me out in displaying database
data in a
TK window.


please wander a little more, on google if you are looking for
readymade script

I have tried a number of ways but I am loosing memory eventually.. I
vet all
"my"'s are not really mine..

All I need to do is fetch from a database and display it In a GUI based
window.
Or some ones has got a a better ways to flush ..

Display real time database data without losing memory in perl TK

Best Regards
SAM



How can any one help if you dont post your code

Ram


What you seem to be doing is not very clear. Why are you running this loop
while (@array = $query->fetchrow_array ) {
($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8,
$field9, $field10,
$field11, $field12, $field13, $field14, $field15, $field16, $field17,
$field18) = @array;}

If you just want the last transaction id change the query
to "select max($field1) from cash where $x = $y ";

This will give you the last transaction id directly


BTW
1) Have you considered using an autoincrement field
2) Do not connect to the database in every function of yours .
Make one connection in the beginning and pass the handle to all functions.
3) And when you post a reply to a newsgroup post your reply *at the
bottom* avoid top posting

Ram

Gary Stainburn
On Tuesday 19 Aug 2003 12:25 pm, Gary Stainburn wrote:
QUOTE
Hi folks,

I'm getting:

Use of uninitialized value in hash element at /home/gary/bin/svcimport line
188, <FIN> line 4301.

when running my program, of which like 188 is:

$addr4=$abbrevs{$addr4} if (defined $abbrevs{$addr4}); # expand
abbreviations

Surely the 'if defined' should prevent this from happening by checking that
it is in fact initialized.  BTW, I'm not getting it for every input line,
but for a significant number.

I've sussed it, I hand an empty pair (''=>'') in the hash from when I was
keying in the key/value pairs.
--
Gary Stainburn

This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000

James D. Durick
I wanted to test the bandwidth for my website every 15 minutes (to verify my
ISP was getting me 1.5 like they say)and was wondering if there are any
modules that make the job easier. Any help would be appreciated.
Currently, there are tools out there that do what I want but I wanted to
write my own and was wondering if anyone had any ideas.
tia

-----Original Message-----
From: Gabriel Cooper [mailto:[Email Removed]]
Sent: Tuesday, August 19, 2003 9:01 AM
To: Voodoo Raja
Cc: [Email Removed]
Subject: Re: Display realtime data As it changes in the databse - TK



Ramprasad A Padmanabhan wrote:

QUOTE
Voodoo Raja wrote:

Sorry for not posting it in the first place.

Will this sub.. chew memory if I run it a number of times.. or does
it overwrite it.

sub read {
print "nreading data";
$db = DBI->connect("DBI:mysql:$dbase:$hostname", $username, $password);

as Ramprasad said, you should pass in your db connection if you use it

in more than one function...

QUOTE

$query = $db->prepare("SELECT * FROM cash where f1 = '1002'");

Generally speaking, if you're selecting " * " then you're doing

something wrong. You should only select exactly what you want from a
database rather than "just give me it all and I'll figure it out later".
Especially because--judging from the loop below--you don't appear to use
anything in the db except the first field, but also because this method
doesn't take into account changing database structure. Ramprasad
suggested "select max($field1) from cash where $x = $y " but keep in
mind you should do this using placeholders where any user input is
involved to protect yourself from SQL injection attacks. =]

QUOTE

$query->execute;
$numrows = $query->rows;
while (@array = $query->fetchrow_array ) {
($field1, $field2, $field3, $field4, $field5, $field6, $field7,
$field8, $field9, $field10,
$field11, $field12, $field13, $field14, $field15, $field16, $field17,
$field18) = @array;}
$query->finish;
$db->disconnect;

Don't disconnect yourself from the database in the middle of a while

loop that's iterating through database query results!
Move finish and disconnect out of the loop.

QUOTE

print "nf1 is $field1";
$lasttrans = "$field1";
$newtrans = ($lasttrans+1);
}

[...]


What you seem to be doing is not very clear.  Why are you running this
loop
while (@array = $query->fetchrow_array ) {
($field1, $field2, $field3, $field4, $field5, $field6, $field7,
$field8, $field9, $field10,
$field11, $field12, $field13, $field14, $field15, $field16, $field17,
$field18) = @array;}

If you just want the last  transaction id  change the query
to "select max($field1) from cash where $x = $y ";

This will give you the last transaction id directly


BTW 1) Have you considered using an autoincrement field
2) Do not connect to the database in every function of yours .
Make one connection in the beginning and pass the handle to all
functions.
3) And when you post a reply  to a newsgroup post your reply *at the
bottom* avoid top posting

Ram








--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

Dan Muey
Howdy,

When starting a new thread don't top post on another thread.

QUOTE
I wanted to test the bandwidth for my website every 15
minutes (to verify my ISP was getting me 1.5 like they
say)and was wondering if there are any modules that make the

That would depend on how you plan to measure the speed. Are you downloading
a file and calulating the speed like "bandwidth testing" places do?

Are you keeping track of packets in a datatbase, interfacing a QOS system, etc?

The method you use to figure that will decide how you go about doing it with Perl.

QUOTE
job easier.  Any help would be appreciated. Currently, there
are tools out there that do what I want but I wanted to write
my own and was wondering if anyone had any ideas. Tia\

What tools are they? Maybe we can find a way to do what they do in Perl.

James Willmore
Shawn Milochik <[Email Removed]> wrote in message news:<[Email Removed]>...
QUOTE
Here's the project:
I want to download my mail, and optionally do zero or more
of the following:

1. Forward certain messages to another e-mail address.
2. Send a particular auto-response, depending upon sender.
3. E-mail a list of all e-mail senders/subjects to another e-mail address.

Then, I want to filter all messages through a Bayesian filter, probably
Spamassassin, then place the good messages back into my original
e-mail account, except in another box, such as "unread" instead of
back into the inbox, and spam into another box, such as "spam"

Okay, so far the only thing you need to do is read the documentation
for spammassassin. There's a few ways to do it. I personally use
MH-mail, procmail, postfix, and fetchmail. Fetchmail picks up the
mail, forwards it to the SMTP server on the box, checks for viruses
(yes, you CAN check mail for viruses on Linux - not that it would harm
anything - but my wife enjoys Windows, so I have to keep her safe and
get her mail - then she grabs the mail off my system ... where was I
.... oh, ya), then it goes through procmail, which has a "recipe" to
filter it using spamassassin (to pick up "stray" spam - read on). So
far, the only thing Perl is spamassassin.

QUOTE

I do not want to use any of the user mail functionality of my
Linux server -- I just want to use my pop3/smtp e-mail account, and
I want everything to be put back into my pop3/smtp e-mail account
after it's been filtered, so that I can check it with webmail.

Well, this again is not Perl, but you can set fetchmail NOT to mark
messages as being read when you get them. Not exactly what you
wanted, but to send mail BACK to your webmail account seems redundent
- but that's my opinion and the fact that I'm spoilled by my ISP
(which does use spamassassin). However, if you want to 'roll your
own' solution, there are several Perl modules to aid you in this task.
Check http://search.cpan.org/

Just a side note: if you are responsible about testing, you're going
to need to set up a mail server anyway. I can speak from experience
that it's a bad idea to use a script (or fetchmail for that matter)
and not test it in a controled environment first. You end up lossing
mail if you don't test first ;)

QUOTE

So the question is, should I use a hobbled together combination of
fetchmail, procmail, and sendmail (hereafter referred to as "FPS"),
or a Perl script?

IMHO, use the tools on your system. They are proven, maintained, and
work. That's not a reflection of any Perl scripts you may find/write
- but why re-invent the wheel? Unless that what's you want to do. I
mean, why write say, a web server in Perl, unless you think you can do
better than Apache -or- want the experience. HOWEVER, I'd ditch
sendmail and start using postfix ... but here again, not Perl and just
my opinion.

If you decide to 'roll your own', you're going to have a monumental
task ahead of you.

HTH

Jim

Cowboy
"Horace Franklin Jr." <[Email Removed]> glsD
:01a201c2f2eb$d2fcbb90$ada5d043@mrsp3e1puadvh3...
Help!

I need help using %hashes to receive input from the form below.

What changes would I make to the syntax of the commented lines
below to do this?.


my $form = <<E_FORM;
<h3>Hello!</h3>
<form action="$url" method="post">
# <p><b>My name is</b>: <input type="text" name="name"/></p>
# <p><b>My E-mail is</b>: <input type="text" name="email"/></p>
<p><b>Message</b>:</p>
# <p><textarea cols="30" rows="6" wrap="virtual" name="message"></p>
<p>Type your message here.
</textarea>
<input type="submit"></p>
</form>
E_FORM

$form;

Marcos Rebelo
old_script.pl | perl -e "while (<>) {print $_; warn $_}" 2> $logFile

Or redefine the print

-----Original Message-----
From: mark sony [mailto:[Email Removed]]
Sent: Wednesday, August 20, 2003 3:11 PM
To: [Email Removed]
Cc: [Email Removed]
Subject: create log as well as print on screen


Hi All,

I wrote a script which is running perfectly fine providing
many outputs on the screen . Only glitch is that it does not print
in a log file . Now what I want is that it would print on the
screen as well as create a log file . At the end of the program I
will output that the above output can also be seen at the
$log_File_position . Hope I am clear with my question . Any type
of pointers and I would be over the moon ;)

Thanx in advance

Mark
___________________________________________________
Meet your old school or college friends from
1 Million + database...
Click here to reunite www.batchmates.com/rediff.asp



--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

Jenda Krynicky
From: "mark sony" <[Email Removed]>
QUOTE
I wrote a script which is running perfectly fine providing
many outputs on the screen . Only glitch is that it does not print in
a log file . Now what I want is that it would print on the screen as
well as create a log file . At the end of the program  I will output
that the above output can also be seen at the $log_File_position .
Hope I am clear with my question . Any type of pointers and I would be
over the moon ;)

http://search.cpan.org/dist/IO-Tee/
http://jenda.krynicky.cz/#Local::TeeOutput

HTH, Jenda
===== [Email Removed] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

James Edward Gray II
On Wednesday, August 20, 2003, at 04:30 PM, Erich Musick wrote:

QUOTE
I'm having trouble doing multiple inheritance...I want to inherit not
only
the subroutines from two classes, but also the instance variables. how
do i
do this?

Methods are the easy part:

our @ISA = qw(ClassOne ClassTwo Etc);

Perl doesn't really provide a method for instance variable inheritance
(even for single inheritance), but you can generally roll your own easy
enough. Here's one possible method:

sub new {
my $class = shift;
my $object = { };
$object = $_->new(%$object) foreach @ISA;
# class specific initialization here...
return bless $object, ref($class) || $class;
}

This is heavily dependent on the classes you are trying to inherit from
though, so you may have to get a little more creative. Watch for
parent classes stomping on each others' member data with this too, it
could happen.

If you need something more robust, you might create instances of the
parent classes as store them internally as private instance data. You
could then basically use your class as a proxy for them, passing what
is needed, to who, when. You probably need to do a little more
subroutine work for this method, though I imagine most of them would
just be one-liners calling the appropriate parent method on the
internal object. A good AUTOLOAD with a little can() magic should even
get you around this, if you're Lazy.

Well, hopefully that at least gives you a couple of ideas. Good luck.

James

Bryan Harris
I often have a line like this at the beginning of my scripts:

@ARGV or die "Usage: blahn";

.... but I've seen:

@ARGV || die "Usage: blahn";

Could someone explain the difference?

- Bryan

John W. Krahn
Shahzad A Khalid wrote:
QUOTE

Hi,

Hello,

QUOTE
I have a similar problem that someone just asked about reading specific
columns from a file and writing to another file. Eventually, I want to
read the written file to be loaded into Matlab. Im having trouble writing
the regular expression for this file. The format of the file looks like this:

Cell1=481 13 N control AFFX-MurIL2_at 0 13 A A A 0  8801  -1  -1  99
Cell2=481 12 N control AFFX-MurIL2_at 0 13 A T A 0  8161  -1  -1  99

I want to read the column mentioning 481 and leaving Cell?= portion.
Then second col. ie 13/12, third col, 5th(AFFX-KurIL2_at) and 7th(13/13).
Please suggest how do i do that. The code i tried is as follows:

$writefilename = 'final.txt';
open(READFILE1,$writefilename);
open(WRITEFILE1,">>cdf.txt");

You should _ALWAYS_ verify that your files were opened correctly:

open( READFILE1, $writefilename ) or die "Cannot open $writefilename:
$!";
open( WRITEFILE1, ">>cdf.txt" ) or die "Cannot open cdf.txt: $!";


QUOTE
@array=<READFILE1>;
$len=scalar(@array);
print $len;
#foreach $lineblock(@array){
#  @colarray=split(/w+=d+s+d+s+ws+w+s+w+-w+-w+s+ds+d+s+ws+ws+ws+ds+d+s+ds+ds+d+/, $lineblock);
#  print WRITEFILE1 @colarray[1];

#}
foreach$lineblock(@array){
@colarray=split(/s*/,$lineblock);

You are telling split() to split on zero or more whitespace which is the
same as splitting the string into individual characters and removing the
whitespace.

$ perl -le'print ">$_<" for split /s*/, "one two"'
QUOTE
o<
n<
e<
t<
w<
o<


QUOTE
$colarray[0]=~ s/Celld=//ig;
foreach $col(@colarray){
print WRITEFILE1 $col;
}
}

According to your code, this should do the same thing:

for ( @array ) {
s/Celld=//i;
s/s+//g;
print WRITEFILE1;
}


QUOTE
close READFILE1;
close WRITEFILE1;
exit;


John
--
use Perl;
program
fulfillment

Jenda Krynicky
From: "Yupapa.com" <[Email Removed]>
QUOTE
If you are transfering file from a local machine to a remote machine,
you do not use File::Copy module to copy files.  File::Copy is used
for copying files locally.  You can use Net::FTP to transfer files
from one machine to another.  And of course, you will need a FTP
server for the machine receiving the file.

This aint entirely true. You can use File::Copy to copy files to
remote shares (Windows Networking), remote drives mounted via NFS ,
.... basicaly anything that the OS allows you to treat like a local
disk.

Jenda
===== [Email Removed] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

Paul Kraus
Without more specifics I can show you how to get the data. This is
assuming a lot because I am confused about what you want to do.
Here is what I gathered.
Read file if line is not all numeric, '-', and spaces then skip.

I am not sure what you want to do with columns that contain 999.999 so I
am going to leave them in the array. That way your subroutines can
account for the 999.999 and do what ever you need to the missing data.

open (IN, "<filename" ) or die ("Could not open file $!n");
While (<IN>){
next unless /^d+/; # if line does not start with numeric skip
my @array = split /s+/;
}

This is untested. But each column should now be in the @array. Column 1
being $array[0].

Hope that helps.
Paul
-----Original Message-----
From: Antonio Jose [mailto:[Email Removed]]
Sent: Thursday, August 21, 2003 9:51 AM
To: [Email Removed]
Subject: Here you have a sample


Here you have a sample of my data:

Column 1 correspond a depth and the rest correspond to diferent
variables

1500.0000 12.6740 -999.2500 0.2204
-999.1.4471
1500.5000 9.1897 -999.2500 0.2200
-999.1.4526
1501.0000 6.5566 -999.2500 0.2161
0.1.4835
1501.5000 4.7251 -999.2500 -999.2500 0.6541
-999.2500 1.7951
1502.0000 3.5049 -999.2500 -999.2500
0.2.2192
1502.5000 3.0459 0.9990 0.0010 1.0000
0.0001 0.0309
1503.0000 2.9346 0.9990 0.0010
1.0000 0.0000 0.0118
1503.5000 2.9598 0.9990 0.0010 1.0000
0.0000 0.0056
1504.0000 3.0054 0.9990 0.0010
1.0000 0.0000 0.0057
1504.5000 3.0642 0.9990 0.0010
1.0000 0.0000 0.0090
1505.0000 3.3259 0.9990 0.0010
1.0000 0.0001 0.0236
1505.5000 4.2054 0.9766 0.0234
1.0000 0.0074 0.0719
1506.0000 5.4658 0.8294 0.1428
1.0000 0.2796 0.2179
1506.5000 6.4538 0.6971 0.1754
0.9981 1.9523 0.5869

We don't have the same lenght by variable, example: we can have 3456
values to variable 1 and 3460 to the second and so for.

Thanks

==============Original message text===============
On Thu, 21 Aug 2003 09:10:01 -0400 "Paul Kraus" wrote:

Can you send some sample data

-----Original Message-----
From: Antonio Jose [mailto:[Email Removed]]
Sent: Thursday, August 21, 2003 8:58 AM
To: [Email Removed]
Subject: Reading columns, Missing data and more


Hello....

I am just learning a bit of Perl but I have some questions;

I have to read a file (numbers of rows variable), to obviate the first
lines until I find only columns with numbers, after, I have to create
vectors with each of this columns (indenpendent columns) but obviating
missing data (represented by the specific number -999.999). After I need
to process this vectors using iteractive method, subroutines, etc. I am
just working but after I define a new vector containing non missing
values I don't know how to read them, the languaje give an error like:
Use of uninitialized value in array element at columnas.pl line xx,
<filename> line YYY

The program is too long to send you but if you want I could

Thanks and excuse my english

Antonio




--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed] ===========End
of original message text===========

Rob Hanson
I'm not well versed in awk, but you could use cut instead...

command | grep bf1 | cut -d ' ' -f 1

....Or just use Perl

# untested
my @var = map {/^w+/;$&} grep {/bf1/} `command`;

QUOTE
on the command line I get exactly what I
need, why doesn't this work during an
external call?

Hmmm... my guess is the $1. The `` interpolates. You need to escape the
dollar sign with a backslash... otherwise it puts the value of $1 into your
command before executing it.

You might want to use strict, it would have caught that.

Rob

-----Original Message-----
From: Bill Akins [mailto:[Email Removed]]
Sent: Thursday, August 21, 2003 2:01 PM
To: [Email Removed]
Subject: Split on white space from `command` return?


Hi!

I would like to grab the first column (variable width) of data in each
line that will be returned from an external command.
I tried @PSARRAY = `command | grep bf1`; and got just the lines with
data I wanted. The returned data looks like this:

EHCFS001 Booted Down bf1/p20 Windows/MU Yes,Opt,0 12:55:29
VMDFS Booted Up bf1/p14 VM25AS21e16/MU Yes,Opt,0
12:52:12
ORA_1 Booted Up bf1/p18 VM25AS21e16/MU Yes,Opt,0
12:56:25
ps3 Booted Up bf1/p3 custom/MU Yes,Opt,0 12:51:56
ps4 Booted Up bf1/p4 custom/MU Yes,Opt,0 12:51:42
ps5 Booted Up bf1/p5 custom/MU Yes,Opt,0 12:51:22

I need to capture just EHCFS001, VMDFS, ORA_1, PS3, PS4 and PS5 in a
var, array, hash, whatever and I don't care about any of the other data.
A variable would be preferable over array, I think.

I then tried @PSARRAY = `command | grep bf1 | awk -F " " '{print $1}'`
but got the same exact results. Anyone know why it didn't like the awk
command or just decided to ignore it?
If I run command | grep bf1 | awk -F " " '{print $1}' on the command
line I get exactly what I need, why doesn't this work during an external
call?

Running on Linux, Perl 5.6.1

Thanks all.



Bill Akins
SSS III
Emory Healthcare
( - Office
12674 - PIC
[Email Removed]

--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

Bill Akins
I did have use strict; on but it didn't complain... Thanks for the input! I'll use Perl.


QUOTE
"Hanson, Rob" <[Email Removed]> 08/21/03 14:14 PM
I'm not well versed in awk, but you could use cut instead...


command | grep bf1 | cut -d ' ' -f 1

....Or just use Perl

# untested
my @var = map {/^w+/;$&} grep {/bf1/} `command`;

QUOTE
on the command line I get exactly what I
need, why doesn't this work during an
external call?

Hmmm... my guess is the $1. The `` interpolates. You need to escape the
dollar sign with a backslash... otherwise it puts the value of $1 into your
command before executing it.

You might want to use strict, it would have caught that.

Rob

-----Original Message-----
From: Bill Akins [mailto:[Email Removed]]
Sent: Thursday, August 21, 2003 2:01 PM
To: [Email Removed]
Subject: Split on white space from `command` return?


Hi!

I would like to grab the first column (variable width) of data in each
line that will be returned from an external command.
I tried @PSARRAY = `command | grep bf1`; and got just the lines with
data I wanted. The returned data looks like this:

EHCFS001 Booted Down bf1/p20 Windows/MU Yes,Opt,0 12:55:29
VMDFS Booted Up bf1/p14 VM25AS21e16/MU Yes,Opt,0
12:52:12
ORA_1 Booted Up bf1/p18 VM25AS21e16/MU Yes,Opt,0
12:56:25
ps3 Booted Up bf1/p3 custom/MU Yes,Opt,0 12:51:56
ps4 Booted Up bf1/p4 custom/MU Yes,Opt,0 12:51:42
ps5 Booted Up bf1/p5 custom/MU Yes,Opt,0 12:51:22

I need to capture just EHCFS001, VMDFS, ORA_1, PS3, PS4 and PS5 in a
var, array, hash, whatever and I don't care about any of the other data.
A variable would be preferable over array, I think.

I then tried @PSARRAY = `command | grep bf1 | awk -F " " '{print $1}'`
but got the same exact results. Anyone know why it didn't like the awk
command or just decided to ignore it?
If I run command | grep bf1 | awk -F " " '{print $1}' on the command
line I get exactly what I need, why doesn't this work during an external
call?

Running on Linux, Perl 5.6.1

Thanks all.



Bill Akins
SSS III
Emory Healthcare
( - Office
12674 - PIC
[Email Removed]

--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

Bill Akins
Awesome! Thanks Bob!

QUOTE
Bob Showalter <[Email Removed]> [SNIP]
Variables are expanded in backticks, so you need to protect the $ on $1, or

use qx'' around your command (but then you have to protect the single quotes

But there's no need for the awk or grep, since perl has functions to handle
that kind of thing. Try something like:

@PSARRAY = map +(split)[0], grep /bf1/, `command`;

John W. Krahn
Ronen Kfir wrote:
QUOTE

I need to delete oldest modified file in a directory. I find this file with this:

my $oldest= printf "%sn", (sort{ (-M $b) <=> (-M$a) } glob("v:*"));
print $oldest;

unlink "$oldest";

What I get in response is:

oldest_filename
1

File is not deleted.

How would I do it?

As you have observed, printf returns true if it worked (or false if it
didn't.) You
could do it like this:

my ( $oldest ) = sort { (-M $b) <=> (-M $a) } glob "v:*";

unlink $oldest or warn "Cannot delete $oldest: $!";


Or like this:

my $oldest = ( sort { (-M $b) <=> (-M $a) } glob "v:*" )[ 0 ];

unlink $oldest or warn "Cannot delete $oldest: $!";


But both of those methods use an inefficient sort because you are
stat()ing each
file more than once. Here are two methods that only stat()s each file
once.

my ( $oldest ) = map $_->[ 0 ],
sort { $b->[ 1 ] <=> $a->[ 1 ] }
map [ $_, -M ],
glob "v:*";

unlink $oldest or warn "Cannot delete $oldest: $!";


This is the most efficient as it only stat()s each file once and it
doesn't have to sort.

my $oldest = [ '', 0 ];
for my $file ( glob "v:*" ) {
my $date = -M $file;
$oldest = [ $file, $date ] if $oldest->[ 1 ] < $date;
}

unlink $oldest->[ 0 ] or warn "Cannot delete $oldest->[0]: $!";



John
--
use Perl;
program
fulfillment

Trina Espinoza
Does anyone know how to set an shell enviroment using perl? I have tried using the backticks, the system command, but they
don't seem to be working. I found ENV{'FLEE'} = 'FLEE'; online, but I don't understand how that works. It sets your enviroment for
a child process but won't change your current environment, is that right? If anyone has suggestions I am all ears.

thanks,

-T



sub setEnviro {
my($var1, $var2) = @_;
print "INSIDE FLEE: $var1n";
print "INSIDE FLAA: $var2n";
#system ("FLEE=$var1"); ##ALL lines below don't seem to work. .. .
#system("FLAA=$var2");

#$ENV{'FLEE'} = 'FLEE';
#$ENV{'FLOO'} = 'FLAA';
`echo $FLEE`;
`echo $FLAA`;

Zsdc
Trina Espinoza wrote:

QUOTE
Does anyone know how to set an shell enviroment using perl? I have tried using the backticks, the system command, but they
don't seem to be working. I found ENV{'FLEE'} = 'FLEE'; online, but I don't understand how that works. It sets your enviroment for
a child process but won't change your current environment, is that right?  If anyone has suggestions I am all ears.

$ENV{FLEE} = 'FLEE';
^remember about the '$' sigil.

See perlvar(1) manpage:
http://www.perldoc.com/perl5.8.0/pod/perlvar.html#%25ENV
"The hash %ENV contains your current environment. Setting a value in ENV
changes the environment for any child processes you subsequently fork()
off."

"Perl programming is an *empirical* science" after all, so you can ckeck
out if it changes the real environment:

#!/usr/bin/perl -wl
print "Old PATH: $ENV{PATH}";
$ENV{PATH} .= ':/ABCDEF';
print "%ENV PATH: $ENV{PATH}";
$/ = "";
open $env, '<', "/proc/$$/environ" or die $!;
while (<$env>) {
print "Real PATH: $1" if /^PATH=(.*)/;
}
close $env;

And it doesn't. %ENV is just a normal hash, it's not tied or anything.
But if it is your only way of reading your environment (and even
POSIX::getenv() just returns the %ENV elements) then it doesn't really
matter. I'm not quite sure if that answers your question though.

QUOTE
sub setEnviro {
my($var1, $var2) = @_;
print "INSIDE FLEE: $var1n";
print "INSIDE FLAA: $var2n";
#system ("FLEE=$var1");    ##ALL lines below don't seem to work. . .
#system("FLAA=$var2");

This won't work, because it will change the environment of the child
shell processes, which doesn't affect the environment of their parent,
i.e. your program process.

QUOTE
#$ENV{'FLEE'} = 'FLEE';
#$ENV{'FLOO'} = 'FLAA';
`echo $FLEE`;
`echo $FLAA`;

Try:

print `echo $FLEE`;
print `echo $FLAA`;

You need to print the value returned by backticks and you need the
backslach to escape the $ sigil, because otherwise perl would
interpolate its $FLEE variable there. Or instead of backticks, just use
system():

system 'echo $FLEE';

You don't have to escape $ in single quotes and system() doesn't capture
the output of your command, so it's just printed to stdout.

-zsdc.

Paul Kraus
Yes because your not shifting any values just a memory address.
Here this might help
---------------
When you do your sub call
mysub ($myvar, $myvar2)
An array is created in your subroutine that holds both those values. It
is called @_.

So in the sub
@_ holds ($myvar, $myvar2),
So $_[0] = $myvar.

All shift does is empty the @_ array

So my $newvar = shift
Would give $newvar the value of $_[0] and remove it from the array
So now the array @_ only holds $myvar2 and it is now $_[0]. The first
varirable was shifted out of the array.

Now as to your question. Your not passing an array just the memory
location of it.
Which is something along the lines of...
ARRAY(0x185f3fc)

That is it. Just that string is all that is in $value of your sub
routine.
Just that string which happens to be an address to the "REAL" array.

You can test this. Simply add a print statement to your routine that
prints $value and you will see what I mean.

When you want to use the values of the array you dereferance it which is
why you are using double $$ or @$
Which reads as the string value contained at this mememory address.

So $$value[0] literaly means use the array item 0 contained at the
memory address of $value.

Its confusing. You should read up on refreances. Or if your not ready to
use them pass the whole array by removing the in the sub call. This
will send the entire array to your subroutine actually it passes a copy
of the array so that changes made in the sub don't affect the real
array.

You could also leave the array as a global variable and not pass it at
all and just use the array like you would anywhere else.

BUY learning perl by oriely. You can blow through it in an afteroon and
it will clear up a lot of this a lot better then I can explain.

I am Ccing the list so that others can contribute. Also if others are
having the same questions you are having it will benefit them. I don't
mind you mailing me directly but if its perl related send a copy to the
list for everyones benefit.

I think I just confused my self :)

Paul

-----Original Message-----
From: Antonio Jose [mailto:[Email Removed]]
Sent: Friday, August 22, 2003 11:20 AM
To: [Email Removed]
Subject: About Shift


Hello

Can I use shift if I want to manipulate and to do calculus with the
vector value?. In the case down it's possible becuase I am not going to
do something with it, only print the length. like this (example):

#!/usr/bin/perl
use strict;
use warnings;

sub suavizar {
my ( $prof, $value ) = ( shift, shift ); # same as ( $_[0], $_[1]
);
$long = . scalar (@$value) . ;
print "Length of value = " long "n"; # @$value
my $nada = 0;
for ($i=0; $i <= $long; ++$i) {
$nada = $value[$i] + $nada;
}
print "addition = "$nada[$i]"n";
(arrary referenced in $value)
}

my $prof = 'some variable';
my @value = ("item1","item2","item3");
suavizar ( $prof, @value );

Thanks

Paul Kraus
WTF now its working with no changes to the program......
This is very frustrating.
Is perl some how looking at the way the directory was last sorted in my
Ms window even though its pulling it from a UNIX server?

-----Original Message-----
From: Paul Kraus [mailto:[Email Removed]]
Sent: Friday, August 22, 2003 2:30 PM
To: [Email Removed]
Subject: Read dir / sort


I have a program that would read a directory and then do some renaming.
Up until recently it always seem to read by oldest file first to newest.
Which is great because my renaming involves incrementing a counter and
placing that count in each file. So if the order was changed the program
will break. Which it did.

So two questions why is it reading the directories different now? How
can I have it read the directory with oldest file first.

Here is the sub routine.

sub getfiles {
my ($amcount, $pmcount);
opendir ( DH, '//sco1/pm6/reports') or die ("Can not open
directoryn");
foreach ( readdir (DH) ) {
next unless /^Sj/;
print "$_n";
#&changefilename( ( stat( "//sco1/pm6/reports/$_" ) ) [9], $_ );
}
die;
foreach (keys %files){
my $counter;
foreach ( @ { $files {$_} } ) {
$counter++;
$_->[1] =~ s/_/_($counter)_/;
print "$_->[1]n";
# rename "//sco1/pm6/reports/$_->[0]", "./$_->[1]" or die ( "NO!
$!n" );
}
}
}


--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

Paul Kraus
Ok tested that theory and it is exactly what it is doing. That is not a
good thing. How can I force it to read the directory based on file date
instead of the way windows last sorted it. That does not seem right to
me that it would function like this.

-----Original Message-----
From: Paul Kraus [mailto:[Email Removed]]
Sent: Friday, August 22, 2003 2:36 PM
To: [Email Removed]; [Email Removed]
Subject: RE: Read dir / sort


WTF now its working with no changes to the program......
This is very frustrating.
Is perl some how looking at the way the directory was last sorted in my
Ms window even though its pulling it from a UNIX server?

-----Original Message-----
From: Paul Kraus [mailto:[Email Removed]]
Sent: Friday, August 22, 2003 2:30 PM
To: [Email Removed]
Subject: Read dir / sort


I have a program that would read a directory and then do some renaming.
Up until recently it always seem to read by oldest file first to newest.
Which is great because my renaming involves incrementing a counter and
placing that count in each file. So if the order was changed the program
will break. Which it did.

So two questions why is it reading the directories different now? How
can I have it read the directory with oldest file first.

Here is the sub routine.

sub getfiles {
my ($amcount, $pmcount);
opendir ( DH, '//sco1/pm6/reports') or die ("Can not open
directoryn");
foreach ( readdir (DH) ) {
next unless /^Sj/;
print "$_n";
#&changefilename( ( stat( "//sco1/pm6/reports/$_" ) ) [9], $_ );
}
die;
foreach (keys %files){
my $counter;
foreach ( @ { $files {$_} } ) {
$counter++;
$_->[1] =~ s/_/_($counter)_/;
print "$_->[1]n";
# rename "//sco1/pm6/reports/$_->[0]", "./$_->[1]" or die ( "NO!
$!n" );
}
}
}


--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

Ed Christian
Paul Kraus wrote:
QUOTE
Ok tested that theory and it is exactly what it is doing. That is not
a good thing. How can I force it to read the directory based on file
date instead of the way windows last sorted it. That does not seem
right to me that it would function like this.

foreach ( readdir (DH) ) {

Mildly tested (and ugly) but how 'bout replacing this with something to
the effect of:

foreach (sort { (stat("//sco1/pm6/reports/$b"))[9] <=>
(stat("//sco1/pm6/reports/$a"))[9] } readdir (DH)) {
:
}

Bob Showalter
Paul Kraus wrote:
QUOTE
WTF now its working with no changes to the program......
This is very frustrating.
Is perl some how looking at the way the directory was last
sorted in my
Ms window even though its pulling it from a UNIX server?

Perl isn't doing anything but calling the OS's underlying readdir(2) call.
You shouldn't make any assumptions about the order in which readdir()
returns files. If you need them in some particular order, read them and then
sort them.

QUOTE

-----Original Message-----
From: Paul Kraus [mailto:[Email Removed]]
Sent: Friday, August 22, 2003 2:30 PM
To: [Email Removed]
Subject: Read dir / sort


I have a program that would read a directory and then do some
renaming. Up until recently it always seem to read by oldest file
first
to newest.
Which is great because my renaming involves incrementing a counter and
placing that count in each file. So if the order was changed
the program
will break. Which it did.

So two questions why is it reading the directories different now? How
can I have it read the directory with oldest file first.

Here is the sub routine.

sub getfiles {
my ($amcount, $pmcount);
opendir ( DH, '//sco1/pm6/reports') or die ("Can not open
directoryn"); foreach ( readdir (DH) ) {
next unless /^Sj/;
print "$_n";
#&changefilename( ( stat( "//sco1/pm6/reports/$_" ) ) [9], $_ );
} die;
foreach (keys %files){
my $counter;
foreach ( @ { $files {$_} } ) {
$counter++;
$_->[1] =~ s/_/_($counter)_/;
print "$_->[1]n";
#      rename "//sco1/pm6/reports/$_->[0]", "./$_->[1]" or die ( "NO!
$!n" ); }
}
}


--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]


John W. Krahn
Paul Kraus wrote:
QUOTE

I have a program that would read a directory and then do some renaming.
Up until recently it always seem to read by oldest file first to newest.
Which is great because my renaming involves incrementing a counter and
placing that count in each file. So if the order was changed the program
will break. Which it did.

So two questions why is it reading the directories different now?

Files are not stored on the file system in any predefined order. If
they appear to be in some order then that is just a coincidence. If you
want the file names in a certain order then you will have to sort them
yourself.


QUOTE
How can I have it read the directory with oldest file first.

my $dir = '//sco1/pm6/reports';

opendir DH, $dir or die "Can not open $dir: $!";

my @files = map $_->[0],
sort { $b->[1] <=> $a->[1] }
map [ $_, -M "$dir/$_" ],
grep /^Sj/,
readdir DH;

closedir DH;



John
--
use Perl;
program
fulfillment

Janek Schleicher
Robert Mark White wrote at Fri, 22 Aug 2003 23:37:48 -0600:

QUOTE
I see the "#!/usr/bin/perl -w" at the top of all programs.
I have read it tells perl where to run the program.

No, it usually tells the (*nix) shell what program has to start
- in this case /usr/bin/perl - and with what kind of arguments - -w -.
The shell then passes all lines but this first one as STDIN to the called
program, in this case perl.

QUOTE
This information I assume refers to a *nix box directory structure.
I am using windows and using activeperl
I think that it may mean I should use #!c:/perl -w,
or am I completely lost here?

Well, the windows shell (dos box) doesn't interpret the shebang line
#!...,
so it doesn't play that important role whether
/usr/bin/perl is written or c:/perl.
However I personally would prefer to write
#!/usr/bin/perl
even on windows as it doesn't matter for windows,
but is more likely to run also on *nix machines

QUOTE
Does the #! command mean anything in windows/activeperl programing?

Yes, allthough windows itself doesn't interpret this line,
perl still scans it.
E.g. it looks for the -w switch or any other possible arguments on the
#! line.

(I believe, perl expects also that the substring "perl" is in the #! line
for interpreting, otherwise it assumes the #... line is really only a
commentar)

QUOTE
c:/perl is where it is located on my machine,
or do I just do it like everyone else for standards sake?
I can not imagine anyone using a *nux box wanting my programs!

Why? Does your program something very operating system specific?
Unless it is an extra work, it's always a good habit to work with
standards and intercompability.
You can't loose anything but perhaps winning in one day some time.


Greetings,
Janek

Rob Dixon
Bob Showalter wrote:
QUOTE
Paul Kraus wrote:
WTF now its working with no changes to the program......
This is very frustrating.
Is perl some how looking at the way the directory was last
sorted in my
Ms window even though its pulling it from a UNIX server?

Perl isn't doing anything but calling the OS's underlying readdir(2) call.
You shouldn't make any assumptions about the order in which readdir()
returns files. If you need them in some particular order, read them and then
sort them.

Exactly. Moreover, you should never assume the order of anything
returned by an iterator like 'readdir' unless it is documented.

The nicest general solution I can think of is to use 'File::Find'
with your 'wanted' routine set to push $File::Find::name onto an
array @files. Then you can just do

@files = sort { -M $A <=> -M $B} @files;

(People will then tell you to use Randalian Transform ;-)
but then I will tell you to worry only if your code is too slow.)

Cheers,

Rob

Oliver Schnarchendorf
On Sun, 24 Aug 2003 01:45:42 +0000, Pablo Fischer wrote:
QUOTE
I have a system (with 3 classes), that works in this order:
[...deleted...]
How good its to do this in 10 seconds?
Exists a website with benckmark running times in Perl?
How good is it??? Depends on your goals and your hardware.


It seems that you attack this from the wrong angle. Everything that is fast enough to solve your problem in a given time is fast enough. I.e. If you don't have any requirements towards how fast you have to sort the data means that your program is fast enough.

The question you are asking is about perl optimization... which is mostly answered with the following answer: DON'T... STOP... DON'T EVEN THINK ABOUT IT.

Various reasons behind all of this is that people don't know which part they have to optimize. Even though their are modules that will help you to find out the lines of code that take the longest.

Take a look at Devel::DProf which is a Perl code profiler.

Though always remember: Optimization takes time, increases complexity, adds bugs, wrecks encapsulation, reduces readability and last but not least makes your code unmaintainable.

thanks
/oliver/

Janek Schleicher
Pablo Fischer wrote at Sun, 24 Aug 2003 01:45:42 +0000:

QUOTE
This maybe its not a Perl question.

I guess it ain't really not one.

QUOTE
I have a system (with 3 classes), that works in this order:


* Check in FTP for new files

Time depends on the time to connect to FTP.
However, the time is always independent of the programming language,
thus neglioabable to your problem.

QUOTE
* Download new Files

Again independent of the programming language.

QUOTE
* Unzip those files (.zip files)

Mostly independent of the programming language,
however you can always use the zip and unzip programs if a solution in a
specific language, e.g. a pure Perl solution might be slower.

So the time depends only on the size of files.

QUOTE
* Each file has 3000 lines, and there are like 10 files (30,000 lines), So I
need to parse the 30,000 lines and order them

Do you need to parse them or do you need to sort them?
However, parsing is something Perl is very good in.
Thus you can simply obtain, a Perlish solution is the quickest way,
so you also don't need to know how quick Perl is.

Sorting is something different as there might be very quick c solution
specialised to sorting on hard disks.

But that depends also on the size of the files.
I assume simply 30_000 lines of 100 columns each
=> 3_000_000 bytes = 3 MB.
3 MB would be nowadays so less that it Perl's memory wasting wouldn't
create problems.
Unless memory problems, common sort routines are very quick in all
languages, also to Perl.

QUOTE
* Parse File by File, and save the parssed file in a DB (MySql)

Depends on the time of the database.

QUOTE
* Check to see if I need a backup of the Zip File

Depends on the check routine, but I assume it is also language independent.

QUOTE
* Finish

How good its to do this in 10 seconds?

It's always possible, you'll only need a computer that is expensive
enough. However, if my guess of 3 MB is right, it should be easy with
nowadays desktop pcs in every language.

QUOTE
Exists a website with benckmark running times in Perl?
Tassilo Von Parseval
On Sun, Aug 24, 2003 at 09:35:39AM +0200 Janek Schleicher wrote:
QUOTE
Pablo Fischer wrote at Sun, 24 Aug 2003 01:45:42 +0000:

Exists a website with benckmark running times in Perl?

http://www.google.com/search?q=benchmark+p...mming+languages

Benchmark between languages are - at the best of times - misleading.
They tend to contrive some seemingly common problems and compare their
implementations in different languages. Not even the p5-porters have so
far managed to come up with a reliable benchmark for comparing perl with
perl (perlbench gives nice tables but real-world programs often seem to
contradict these tables).

But as it can be seen in this thread, the problem wont be solved using
pure-Perl. Database access usually happens via modules written in C.
Therefore, a program making heavy use of an SQL database written in pure C
and one written in Perl will yield very comparable results.

I remember the longest-repeated-substring problem that was discussed
some months ago on MJD's quiz-of-the-week mailinglist. A reasonably fast
Perl solution looked very un-Perlish (doing it all with raw index() and
substr() operations for the sake of speed) and thus was easy to
translate to XS. The C implementation was faster to an degree of 5%, at
most. But sometimes it was even slower.

On the other hand, Octave for instance was written in C and Fortran. If
you take this and compare it with an implementation in Perl (if it
existed), it will surely make Perl look very poor.

So only for very sanitized ('pure') problems you'll be able to predice
which implementation will likely be fastest. The problem of the OP is no
such case. First you have the overhead of the FTP transaction,
afterwards unzipping that can either be done the slow way (Archive::Zip)
or in an intelligent way (when speed matters) through PerlIO::gzip or
even an external unzipper.

The only thing that really might make look one language more appropriate
than the other is the sorting. But again, precise figures can't be given
since Perl's sort is either very performant (when using one of the
optimized default routines) or painfully slow (with a complicated custom
comparison-routine).

Then a little bit I/O is carried out. Again, only little significance to
the language (they all are somewhat C-based). Yet, Perl is known to do
I/O a little better than most competitors. Eventually, database-access.
That's no concern when using one of the C-implementations in the DBD::
namespace.

Conclusion: most common languages should be able to do that in
reasonable time. They are no different than Perl in that they interface
with C code for tasks like working with compressed files, I/O and
databases. Unless of course you do in PROLOG or some other truely exotic
language.

Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.t$&."'!#+sexisexiixesixeseg;y~n~~dddd;eval


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.