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!
Wiggins D Anconia
QUOTE

Does anyone see anything logically wrong with my code b/c I am still not
receiving the correct data in the email.  The data is a # 1 when it
should
be a listing of Exxxxx strings.

thank you!

## Set pragmas

use strict;
use MIME::Lite;

## Set and edit variables

my $foreigntapes="/usr/local/log/foreign_tapes.log";
delete $ENV{'IFS'};
local $ENV{'PATH'} =
"/usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin:/bin:/sbin";
#print $ENV{'PATH'},"n";

## Traverse through array and play with data

open (OUT, ">$foreigntapes") || die "could not open file:$!";
my @ftapes = grep s/^barcode=//, `evmvol -w label_state=1`;
print OUT "@ftapes";
#if ( -s @ftapes ) {
my $msg = MIME::Lite->new(
From    => 'EDM01 <[Email Removed]>',
To      => 'Derek Smith <[Email Removed]>',
Subject => "Foreign Tapes Found, now
attmepting to
label",
Data    => print "@ftapes" );

Still don't understand why there is a 'print' in the above line? I
believe Perl is evaluating that and using the return value of print, aka
1 since it is successful as the data. This has been mentioned several
times but it is still in there, there should not be a 'print' at all.

QUOTE
msg->send;


You are missing a sigil in the above line, should be $msg->send.

http://danconia.org

Christopher Lyon
QUOTE
-----Original Message-----
From: [Email Removed] [mailto:[Email Removed]]
Sent: Friday, June 04, 2004 1:42 PM
To: [Email Removed]
Subject: RE:mime lite

Does anyone see anything logically wrong with my code b/c I am still
not
receiving the correct data in the email.  The data is a # 1 when it
should
be a listing of Exxxxx strings.

thank you!

## Set pragmas

use strict;
use MIME::Lite;

## Set and edit variables

my $foreigntapes="/usr/local/log/foreign_tapes.log";
delete $ENV{'IFS'};
local $ENV{'PATH'} > "/usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin:/bin:/sbin";
#print $ENV{'PATH'},"n";

## Traverse through array and play with data

open (OUT, ">$foreigntapes") || die "could not open file:$!";
my @ftapes = grep s/^barcode=//, `evmvol -w label_state=1`;
print OUT "@ftapes";
#if ( -s @ftapes ) {
my $msg = MIME::Lite->new(
From    => 'EDM01 <[Email Removed]>',
To      => 'Derek Smith
<[Email Removed]>',
Subject => "Foreign Tapes Found, now
attmepting to
label",
Data    => print "@ftapes"
Change this line to read

Data => "@ftapes"

See if that works!


QUOTE
msg->send;

#foreach (@ftapes) {
#print $_;
#`evmlabel -l st_9840_acs_0 -t 9840S -b$_`
#}
close (OUT);
#} else {
#      my $foo="/tmp/ftapes_runfile";
#      open (RUNFILE, ">$foo") || die "could not open
runfile:
$!;"
#}
#close (RUNFILE);

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams






<[Email Removed]
06/04/2004 10:58 AM
Please respond to cslyon


To:    <[Email Removed]>, <[Email Removed]
cc:
Subject:        RE: sendmail


-----Original Message-----
From: [Email Removed] [mailto:[Email Removed]]
Sent: Friday, June 04, 2004 6:39 AM
To: [Email Removed]
Subject: sendmail

ok here it what I did and it is emailing sporadically or not at
all???
Also it is not placing the array data into the email body???
it is like the if clause it not working.

thank you!

## Set pragmas

use strict;
use Mail::Sendmail;

## Set and edit variables

my $foreigntapes="/usr/local/log/foreign_tapes.log";
delete $ENV{'IFS'};
local $ENV{'PATH'} > > "/usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin:/bin:/sbin";
#print $ENV{'PATH'},"n";

## Traverse through array and play with data

open (OUT, ">$foreigntapes") || die "could not open
file:$!";
my @ftapes = grep s/^barcode=//, `evmvol -w label_state=1`;
print OUT "@ftapes";


I would try to test something else besides the handle. I know you can
do
these types of tests against a file but a handle? Not sure if that is
the
best way to do it. Besides, you are testing if the file exists and
have a
nonzero size against a handle. Test the array maybe?



if ( -s OUT ) {
my %mailman = ( From    => 'EDM01 <[Email Removed]>',
To        => 'Derek Smith
<[Email Removed]>',
Subject    => "Foreign Tapes Found, now
attmepting
to
label" ,
Message    =>  print OUT "@ftapes" );

Try this for the Message line instead:
Message    =>  "@ftapes" );

You might also want to try MIME::Lite for sending this. I know there
is a
bunch of discussion about Mail::Sendmail and having it work correctly
and
everybody recommends MIME::Lite instead. I was using Mail::Sendmail
for a
bunch of things and moved everything over to MIME::Lite. Works like a
charm!


sendmail (%mailman) or die
$Mail::Sendmail::error;

foreach (@ftapes) {
print $_;
#`evmlabel -l st_9840_acs_0 -t 9840S
-b$_`
}
close (OUT);
} else {
my $foo="/tmp/ftapes_runfile";
open (RUNFILE, ">$foo") || die "could not open
runfile:
$!;"
#exit 0;
}
close (RUNFILE);


derek




--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]
<http://learn.perl.org/> <http://learn.perl.org/first-response





Chris Lyon
QUOTE
-----Original Message-----
From: [Email Removed] [mailto:[Email Removed]]
Sent: Friday, June 04, 2004 1:42 PM
To: [Email Removed]
Subject: RE:mime lite

Does anyone see anything logically wrong with my code b/c I am still not
receiving the correct data in the email.  The data is a # 1 when it should
be a listing of Exxxxx strings.

thank you!

## Set pragmas

use strict;
use MIME::Lite;

## Set and edit variables

my $foreigntapes="/usr/local/log/foreign_tapes.log";
delete $ENV{'IFS'};
local $ENV{'PATH'} =
"/usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin:/bin:/sbin";
#print $ENV{'PATH'},"n";

## Traverse through array and play with data

open (OUT, ">$foreigntapes") || die "could not open file:$!";
my @ftapes = grep s/^barcode=//, `evmvol -w label_state=1`;
print OUT "@ftapes";
#if ( -s @ftapes ) {
my $msg = MIME::Lite->new(
From    => 'EDM01 <[Email Removed]>',
To      => 'Derek Smith <[Email Removed]>',
Subject => "Foreign Tapes Found, now attmepting to
label",
Data    => print "@ftapes" );
Change this line to read

Data => "@ftapes"


QUOTE
msg->send;

#foreach (@ftapes) {
#print $_;
#`evmlabel -l st_9840_acs_0 -t 9840S -b$_`
#}
close (OUT);
#} else {
#      my $foo="/tmp/ftapes_runfile";
#      open (RUNFILE, ">$foo") || die "could not open runfile:
$!;"
#}
#close (RUNFILE);

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams






<[Email Removed]
06/04/2004 10:58 AM
Please respond to cslyon


To:    <[Email Removed]>, <[Email Removed]
cc:
Subject:        RE: sendmail


-----Original Message-----
From: [Email Removed] [mailto:[Email Removed]]
Sent: Friday, June 04, 2004 6:39 AM
To: [Email Removed]
Subject: sendmail

ok here it what I did and it is emailing sporadically or not at all???
Also it is not placing the array data into the email body???
it is like the if clause it not working.

thank you!

## Set pragmas

use strict;
use Mail::Sendmail;

## Set and edit variables

my $foreigntapes="/usr/local/log/foreign_tapes.log";
delete $ENV{'IFS'};
local $ENV{'PATH'} =
"/usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin:/bin:/sbin";
#print $ENV{'PATH'},"n";

## Traverse through array and play with data

open (OUT, ">$foreigntapes") || die "could not open file:$!";
my @ftapes = grep s/^barcode=//, `evmvol -w label_state=1`;
print OUT "@ftapes";


I would try to test something else besides the handle. I know you can do
these types of tests against a file but a handle? Not sure if that is the
best way to do it. Besides, you are testing if the file exists and have a
nonzero size against a handle. Test the array maybe?



if ( -s OUT ) {
my %mailman = ( From    => 'EDM01 <[Email Removed]>',
To        => 'Derek Smith
<[Email Removed]>',
Subject    => "Foreign Tapes Found, now attmepting
to
label" ,
Message    =>  print OUT "@ftapes" );

Try this for the Message line instead:
Message    =>  "@ftapes" );

You might also want to try MIME::Lite for sending this. I know there is a
bunch of discussion about Mail::Sendmail and having it work correctly and
everybody recommends MIME::Lite instead. I was using Mail::Sendmail for a
bunch of things and moved everything over to MIME::Lite. Works like a
charm!


sendmail (%mailman) or die $Mail::Sendmail::error;

foreach (@ftapes) {
print $_;
#`evmlabel -l st_9840_acs_0 -t 9840S -b$_`
}
close (OUT);
} else {
my $foo="/tmp/ftapes_runfile";
open (RUNFILE, ">$foo") || die "could not open runfile:
$!;"
#exit 0;
}
close (RUNFILE);


derek




--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]
<http://learn.perl.org/> <http://learn.perl.org/first-response





David Storrs
On Fri, Jun 04, 2004 at 03:15:28PM -0000, aditi wrote:
QUOTE
hi,

i have to blast genes of human Y chromosome(104 genes)with genomes of non
human species to find which genes are conserved on Y and on non-Y
chromosomes in other species.and for each gene,its chromosome its 5' and
3'end location w.r.t. human Y gene and similarity percentage is also
required.
if done manually,it would amount for over 3000 blasts.it would be of great
help if anyone could tell me the link to a perl script or similar script ,
if available.

thanking you,

aditi


Just for the record...I think I understood all of those words, but I
have no idea what you asked for. It sounds like your question is
"could someone please write a script that does this"? If that is the
case, I'm afraid it's a bit out of scope for this list--at least, if
you want it done for free. I'm sure many of us are contractors (I
certainly am) and would be willing to be hired to do it. But we can't
do it for free.

If you have questions that are more specifically Perl related, we'd be
glad to answer those for you.

--Dks
[Email Removed]

Bob Showalter
Andrew Gaffney wrote:
QUOTE
I didn't really know where to post this since it isn't specifically
Apache or Perl, so I'm posting here....just because :)

I run 2 vhosts under Apache 1.3.29 (needed for mod_perl-1.x which is
needed by HTML::Mason) on my Gentoo server. One vhost is the current
production site and the other vhost is the development version of the
site. I use a custom Perl module for authentication and other common
functions for all my Perl CGI/mod_perl scripts.

I want to be able to make changes to the module, but I only want it
to affect the second vhost. Basically, I need to have 2 copies of my
custom module, one for each vhost. Is there an easy way to do this?

If you have only one instance of Apache, I think the answer is no. The
multiple virtual hosts still share the single perl interpreter.

Why not just run two instances of Apache and put your development version on
the second (listen on port 8080 or some such)?

Keith
UNCLASSIFIED

There's also gvim for windows
http://www.vim.org

-----Original Message-----
From: John W. Krahn [mailto:[Email Removed]]
Sent: Saturday, June 05, 2004 5:02 PM
To: [Email Removed]
Subject: Re: vi editor


Aditi gupta wrote:
QUOTE

hi,

Hello,

QUOTE
vi is used only in unix and linux.
QUOTE
which editor can be used in windows and is better than notepad.

http://www.ultraedit.com/
http://slickedit.com/


John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

Bob Showalter
Andrew Gaffney wrote:
QUOTE
I will end up having more than 2 vhosts, most of which will need a
custom version of this particular module.

In that case, I think you'll need to give the modules different names. You
could write your handler in such a way that it would recompile the module
(switching flavors) with each request, but that would kind of defeat the
purpose of mod_perl...

Andrew Gaffney
Bob Showalter wrote:
QUOTE
Andrew Gaffney wrote:

I didn't really know where to post this since it isn't specifically
Apache or Perl, so I'm posting here....just because :)

I run 2 vhosts under Apache 1.3.29 (needed for mod_perl-1.x which is
needed by HTML::Mason) on my Gentoo server. One vhost is the current
production site and the other vhost is the development version of the
site. I use a custom Perl module for authentication and other common
functions for all my Perl CGI/mod_perl scripts.

I want to be able to make changes to the module, but I only want it
to affect the second vhost. Basically, I need to have 2 copies of my
custom module, one for each vhost. Is there an easy way to do this?


If you have only one instance of Apache, I think the answer is no. The
multiple virtual hosts still share the single perl interpreter.

Why not just run two instances of Apache and put your development version on
the second (listen on port 8080 or some such)?

I will end up having more than 2 vhosts, most of which will need a custom
version of this particular module.

--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.


Anthony J Segelhorst
I have a perl script that I am setting up in crontab to run and when
running the script under that user the script runs fun because the
..profile runs and the environment variables are set up.

I can I easily call the .profile within the script and keep the
environment variables throughout the rest of the script? or do I need to
manually call all items in the .profile.


This is what is currently in the .profile
# FAXCOMMANDER SETUP (BEGIN)
#
if test -f /usr2/faxmgr/cfg/scripts/profile; then
. /usr2/faxmgr/cfg/scripts/profile
fi
#
# FAXCOMMANDER SETUP ( END )
export ENV=$HOME/.kshrc

Anthony J Segelhorst
Enterprise Systems Management Team
Phone:
Email: [Email Removed]




________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service._______________________________________________________________

This electronic message contains information from MeadWestvaco
Corporation or subsidiary companies, which may be confidential,
privileged or otherwise protected from disclosure. The
information is intended to be used solely by the recipient(s)
named. If you are not an intended recipient, be aware that
any review, disclosure, copying, distribution or use of this
transmission or its contents is prohibited. If you have
received this transmission in error, please notify MeadWestvaco
immediately at [Email Removed].
_______________________________________________________________________

Roberto Etcheverry
QUOTE
hi all,
can anyone tel me how to look for files which conatain dotsin it.
i.e
file1.txt
file2.txt
how  to  check for dots in filename  using regular expression.
is it correct

my  $ty=polica.op
if($ty =m/ (.*).o/)

The regular expresion should be /(.*).o/. Otherwise you'll try to match a
filename beginning with a space.

QUOTE
print found;


plz reply soon

sid

---------------------------------------------------------------------------------------------------------------------------------
"There is nothing in a caterpillar that tells you it's going to be a
butterfly."  - Anonymous

*********************************************
Sidharth M Patil
Engineer
Kyocera-Wireless (India) Pvt Ltd
5th Floor, Phase I, Divyashree Towers,
Guruppanapalya, Bannerghatta Road,
Bangalore-560072
Tel : 51106988  extn  5171
*********************************************


Andrew Gaffney
Bob Showalter wrote:
QUOTE
Andrew Gaffney wrote:

I will end up having more than 2 vhosts, most of which will need a
custom version of this particular module.


In that case, I think you'll need to give the modules different names. You
could write your handler in such a way that it would recompile the module
(switching flavors) with each request, but that would kind of defeat the
purpose of mod_perl...

Is there a way to auto-import a particular module in the vhost definition so
that my scripts don't have to 'use' it? I think that would give me the results
I'm looking for.

--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.


Wiggins D'Anconia
Roberto Etcheverry wrote:
QUOTE
hi all,
can anyone tel me how to look for files which conatain dotsin it.
i.e
file1.txt
file2.txt
how  to  check for dots in filename  using regular expression.
is it correct

my  $ty=polica.op
if($ty =m/ (.*).o/)


The regular expresion should be /(.*).o/. Otherwise you'll try to match a
filename beginning with a space.



Can probably dispense with the (.*) at the beginning, and you may want
to anchor the '.o' at the end, otherwise you will match filenames that
have a '.o' embedded, like 'filename.ok.txt'...

/.o$/

If you want to make sure that there is something before the initial dot,
then you need to switch the * to a +, and can probably avoid the
grouping, unless you need it for something else,

/.+.o/

Of course, to answer the question precisely, if you just want to see if
a filename contains a dot, without specifying where, then just

/./

Should work.

perldoc perlretut
perldoc perlre

http://danconia.org

Raminder G
Hi,
I could use open(STDOUT,"| more") option to more big file.
After this, I close STDOUT as if, I do not close, readline prints the prompt even when more is not 100%.
#######################################
open(STDOUT,"| more") || "Cannot open stdout for more $!";
$status = system("cat report.txt");
$status = system("clear");
close STDOUT;
## If I do not close handler then I get the prompt(see below) on
## the very first page of the screen. I need to ask this once
# more is done with 100% display of file. Actually, before #deletion I want to show the #data to user and then ask about his #consent for deletion.

$term = new Term::ReadLine '999';
$prompt = "All the rows displayed above will be removednDo you want to continue?(Y/N) :";
$option = $term->readline($prompt);
######################################

Now if i try to print the option. I do not get anything even if user says 'y'. Looks like if i close STDOUT, readline does not read.
Any pointers will be appreciated.

Thanks,
Raminder


Bob Showalter <[Email Removed]> wrote:
[Email Removed] wrote:
QUOTE
Hi There,
Any pointers to how to call "more" on a file in perl script.
I am writing one script which displays one report to user and then
asks some inputs.

User need to see complete file. To solve this, I thought I can call
`more in the script and continue.
But looks loke it is not possible.

You didn't post your script, so I can only guess.

You can't use backticks, since they capture the output. If more is writing
to a non-tty (because you're capturing the output), it obviously has no way
to pause at a screenful, so it just passes the entire input to the output.

You need to use system() instead.

Also, it's customary to respect $ENV{PAGER}. I have my pager set to less,
for example.

Read "perldoc perlopentut" and search for PAGER to see an example of how to
do this kind of thing.

---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger

Wiggins D Anconia
QUOTE
Hi,

I have a rather simple question that Google hasn't produced answers for.
Basically, I am installing Mason in a virtual host under mod_perl. The
libraries I need are housed in ~/my/lib


Really, your exact subject line gave 3-4 pages that provided similar
answers at the top of the listing...

QUOTE
How might I make Apache aware of ~/my/lib from the httpd.conf so that the
following:

PerlModule HTML::Mason::ApacheHandler

will load? What is the equivalent for the httpd.conf of use
lib('/my/lib'); ?

Wiggins D Anconia
QUOTE
I'm in the process of learning perl (hmm - right at the beginning of this
process), and I'm having great difficulty working my way through the man
pages. I'm a Windows user and perl is the first language I'm learning, so
*everything* is new to me. I am also having to get to grips with using my
shell account which is just adding to the difficulties.

What would really make my life easier right now is a glossary of
programming
specific terms so that I'm not struggling to find meanings for the
terminology used in some of the man pages (specifically I'm trying to work
my way through man screen) every other word. Does such a glossary
exist? I'm
aware of the Jargon Files and I'm aware that many of these terms have man
pages of their own (but my entire reason for reading man screen is to
learn
how to have different windows open with different things going on in each
window!).

Thank you for all your help,


The wikipedia is often a good place to find definitions of various types.

http://en.wikipedia.org/wiki/Main_Page

HTH,

http://danconia.org

Keith
UNCLASSIFIED

Beginning Perl is a great book to start out with. It gives great examples
and explanations. You can probably find it at an online bookstore to buy
(ISBN:1-861003-14-5)

It's also in online form here:
http://learn.perl.org/library/beginning_perl/

Enjoy...

-----Original Message-----
From: Karen McAtamney [mailto:[Email Removed]]
Sent: Tuesday, June 08, 2004 3:36 PM
To: [Email Removed]
Subject: Glossary


I'm in the process of learning perl (hmm - right at the beginning of this
process), and I'm having great difficulty working my way through the man
pages. I'm a Windows user and perl is the first language I'm learning, so
*everything* is new to me. I am also having to get to grips with using my
shell account which is just adding to the difficulties.

What would really make my life easier right now is a glossary of programming
specific terms so that I'm not struggling to find meanings for the
terminology used in some of the man pages (specifically I'm trying to work
my way through man screen) every other word. Does such a glossary exist? I'm
aware of the Jargon Files and I'm aware that many of these terms have man
pages of their own (but my entire reason for reading man screen is to learn
how to have different windows open with different things going on in each
window!).

Thank you for all your help,

Karen


--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

Bob Showalter
Roberto Etcheverry wrote:
QUOTE
chomp for @array; # trim "n" at the end

or

chomp(@array);

or even

chomp(my @array = <ID>);

Philcalvert
Hi All,

I've been trying to install a module and haven't been having much luck.
Here's what I get;


thatsme-Computer:~ thatsme$ sudo perl -MCPAN -e 'install libwww-perl'
CPAN: Storable loaded ok
Going to read /Users/thatsme/.cpan/Metadata
Database was generated on Wed, 09 Jun 2004 23:34:22 GMT
Warning: Cannot install 0, don't know what it is.
Try the command

i /0/

to find objects with matching identifiers.

Thanks for any help in advance.

--Phil

Phil Calvert
Thanks for the reply.

I just tried that and got;

Can't locate object method "install" via package "LWP" at -e line 1.

--Phil


On Jun 9, 2004, at 10:07 PM, Ramprasad A Padmanabhan wrote:

QUOTE
What I usually do is directly try installing the modules required , say
LWP

Try
sudo perl -MCPAN -e 'install LWP'

HTH
Ram



On Thu, 2004-06-10 at 07:32, philcalvert wrote:
Hi All,

I've been trying to install a module and haven't been having much
luck.
Here's what I get;


thatsme-Computer:~ thatsme$ sudo perl -MCPAN -e 'install libwww-perl'
CPAN: Storable loaded ok
Going to read /Users/thatsme/.cpan/Metadata
Database was generated on Wed, 09 Jun 2004 23:34:22 GMT
Warning: Cannot install 0, don't know what it is.
Try the command

i /0/

to find objects with matching identifiers.

Thanks for any help in advance.

--Phil




--Phil Calvert

Faculty/Staff CSUN Music Dept.

Ramprasad A Padmanabhan
What I usually do is directly try installing the modules required , say
LWP

Try
sudo perl -MCPAN -e 'install LWP'

HTH
Ram



On Thu, 2004-06-10 at 07:32, philcalvert wrote:
QUOTE
Hi All,

I've been trying to install a module and haven't been having much luck.
Here's what I get;


thatsme-Computer:~ thatsme$ sudo perl -MCPAN -e 'install libwww-perl'
CPAN: Storable loaded ok
Going to read /Users/thatsme/.cpan/Metadata
Database was generated on Wed, 09 Jun 2004 23:34:22 GMT
Warning: Cannot install 0, don't know what it is.
Try the command

i /0/

to find objects with matching identifiers.

Thanks for any help in advance.

--Phil


Phil Calvert
OK that seem to get me farther along but now I get;

make: *** No rule to make target
`/System/Library/Perl/5.8.1/darwin-thread-multi-2level/CORE/config.h',
needed by `Makefile'. Stop.
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible


Which is different from before but still sounds bad...;-(

--Phil

On Jun 9, 2004, at 10:10 PM, Ramprasad A Padmanabhan wrote:

QUOTE
Sorry, That does not seem to work

Try this instead
perl -MCPAN -e 'CPAN::install LWP'


On Thu, 2004-06-10 at 10:37, Ramprasad A Padmanabhan wrote:
What I usually do is directly try installing the modules required ,
say
LWP

Try
sudo perl -MCPAN -e 'install LWP'

HTH
Ram



On Thu, 2004-06-10 at 07:32, philcalvert wrote:
Hi All,

I've been trying to install a module and haven't been having much
luck.
Here's what I get;


thatsme-Computer:~ thatsme$ sudo perl -MCPAN -e 'install libwww-perl'
CPAN: Storable loaded ok
Going to read /Users/thatsme/.cpan/Metadata
Database was generated on Wed, 09 Jun 2004 23:34:22 GMT
Warning: Cannot install 0, don't know what it is.
Try the command

i /0/

to find objects with matching identifiers.

Thanks for any help in advance.

--Phil





Ramprasad A Padmanabhan
Sorry, That does not seem to work

Try this instead
perl -MCPAN -e 'CPAN::install LWP'


On Thu, 2004-06-10 at 10:37, Ramprasad A Padmanabhan wrote:
QUOTE
What I usually do is directly try installing the modules required , say
LWP

Try
sudo perl -MCPAN -e 'install LWP'

HTH
Ram



On Thu, 2004-06-10 at 07:32, philcalvert wrote:
Hi All,

I've been trying to install a module and haven't been having much luck.
Here's what I get;


thatsme-Computer:~ thatsme$ sudo perl -MCPAN -e 'install libwww-perl'
CPAN: Storable loaded ok
Going to read /Users/thatsme/.cpan/Metadata
Database was generated on Wed, 09 Jun 2004 23:34:22 GMT
Warning: Cannot install 0, don't know what it is.
Try the command

i /0/

to find objects with matching identifiers.

Thanks for any help in advance.

--Phil


Phil Calvert
OK, after poking around a bit it seems that the the developer tools
need to be installed. Having done that I now get this after running the
line

perl -MCPAN -e 'CPAN::install LWP'



Failed Test Stat Wstat Total Fail Failed List of Failed
------------------------------------------------------------------------
-------
html/form-param.t 2 512 24 48 200.00% 1-24
html/form.t 2 512 52 104 200.00% 1-52
local/autoload-get.t 1 1 100.00% 1
local/autoload.t 1 1 100.00% 1
local/get.t 2 512 2 4 200.00% 1-2
local/http-get.t 20 6 30.00% 1-2 5-7 20
local/http.t 18 6 33.33% 1-2 5-7 18
robot/ua-get.t 8 2 25.00% 3 5
robot/ua.t 7 2 28.57% 3 5
Failed 9/30 test scripts, 70.00% okay. 96/660 subtests failed, 85.45%
okay.
make: *** [test] Error 2
/usr/bin/make test -- NOT OK
Running make install
make test had returned bad status, won't install without force



Which seems to suggest that I need to "force" make? How do I do that
(if that's want I need to do)?

Thanks,

--Phil


On Jun 9, 2004, at 10:10 PM, Ramprasad A Padmanabhan wrote:

QUOTE
Sorry, That does not seem to work

Try this instead
perl -MCPAN -e 'CPAN::install LWP'


On Thu, 2004-06-10 at 10:37, Ramprasad A Padmanabhan wrote:
What I usually do is directly try installing the modules required ,
say
LWP

Try
sudo perl -MCPAN -e 'install LWP'

HTH
Ram



On Thu, 2004-06-10 at 07:32, philcalvert wrote:
Hi All,

I've been trying to install a module and haven't been having much
luck.
Here's what I get;


thatsme-Computer:~ thatsme$ sudo perl -MCPAN -e 'install libwww-perl'
CPAN: Storable loaded ok
Going to read /Users/thatsme/.cpan/Metadata
Database was generated on Wed, 09 Jun 2004 23:34:22 GMT
Warning: Cannot install 0, don't know what it is.
Try the command

i /0/

to find objects with matching identifiers.

Thanks for any help in advance.

--Phil




--Phil Calvert

Faculty/Staff CSUN Music Dept.

Bob Showalter
jason corbett wrote:
QUOTE
Hello all. Can someone tell me what is the difference in the various
ways to FETCH data from a database? I bought like 3 books and they
don't really go in depth with the reasons why there are several of
them, and what happens if you interchange them with different
scenarios.


I assume you're talking about the DBI module. If not, ignore everything that
follows :~)

QUOTE
Here are the ones that I am asking about:

Fetch
Fetchrow
Fetchrow_array
fetchall_arrayref
fetchrow_hashref

fetch and fetchrow are aliases for fetchrow_arrayref and fetchrow_array, and
you forgot fetchrow_hashref, as well as the database handle methods
selectrow_array, selectrow_arrayref, selectrow_hashref, selectall_arrayref,
selectall_hashref, and selectcol_arrayref.

They break down into families based on number of rows returned (one or all),
and type of return value (array, arrayref, or hashref)

I think that DBI implements everything in terms of fetchrow_arrayref, so the
other formats are just convenience for difference situations. Why you would
use one over the other depends on what the structure of your data is and
what the needs of your application are.

James Edward Gray II
On Jun 10, 2004, at 9:39 AM, Phil Calvert wrote:

QUOTE
OK, after poking around a bit it seems that the the developer tools
need to be installed. Having done that I now get this after running
the line

perl -MCPAN -e 'CPAN::install LWP'

Try:

sudo perl -MCPAN -e 'install LWP'

You'll need to give the admin password for this.

James

Phil Calvert
Hello,

Thanks for the reply.

When I try that I get;

Can't locate object method "install" via package "LWP" at -e line 1.


I should also say that I tried "sudo perl -MCPAN -e 'CPAN::install
LWP'" and got the result that I reported previously.


On Jun 10, 2004, at 9:07 AM, James Edward Gray II wrote:

QUOTE
On Jun 10, 2004, at 9:39 AM, Phil Calvert wrote:

OK, after poking around a bit it seems that the the developer tools
need to be installed. Having done that I now get this after running
the line

perl -MCPAN -e 'CPAN::install LWP'

Try:

sudo perl -MCPAN -e 'install LWP'

You'll need to give the admin password for this.

James


--Phil Calvert

Faculty/Staff CSUN Music Dept.

James Edward Gray II
On Jun 10, 2004, at 11:15 AM, Phil Calvert wrote:

QUOTE
Hello,

Thanks for the reply.

When I try that I get;

Can't locate object method "install" via package "LWP" at -e line 1.


I should also say that I tried "sudo perl -MCPAN -e 'CPAN::install
LWP'" and got the result that I reported previously.

You might try taking this question to the Mac OS X Perl mailing list.

http://lists.perl.org/showlist.cgi?name=macosx

This is right up their alley and they're pretty helpful. Sorry I
couldn't be more help.

James

Phil Calvert
Thanks for the pointer - I wondered if there was such a list and I
looked for one (obviously, not hard enough).

Thanks again.

--Phil
On Jun 10, 2004, at 9:37 AM, James Edward Gray II wrote:

QUOTE
On Jun 10, 2004, at 11:15 AM, Phil Calvert wrote:

Hello,

Thanks for the reply.

When I try that I get;

Can't locate object method "install" via package "LWP" at -e line 1.


I should also say that I tried "sudo perl -MCPAN -e 'CPAN::install
LWP'" and got the result that I reported previously.

You might try taking this question to the Mac OS X Perl mailing list.

http://lists.perl.org/showlist.cgi?name=macosx

This is right up their alley and they're pretty helpful.  Sorry I
couldn't be more help.

James


--Phil Calvert

Faculty/Staff CSUN Music Dept.

Tim Johnson
You can use the -d file test to check if the file is a directory before moving it.



unless(-d $whatever_file){

do whatever...





-----Original Message-----

From: "Shu Hung (樹雄)" [mailto:[Email Removed]]

Sent: Fri 6/11/2004 3:50 AM

To: Perl Beginner Mail Group

Cc:

Subject: search and move 'expired files'







Hello all,



I want a script to move all 'expired files' to a folder.

So I wrote the script below.



However, a problem came out: the find function run everything

in the address, including the entire folders structure!!!

YvwgY雊
Tim Johnson 提到:

QUOTE
You can use the -d file test to check if the file is a directory before moving it.

unless(-d $whatever_file){
do whatever...


-----Original Message-----
From: "Shu Hung (樹雄)" [mailto:[Email Removed]]
Sent: Fri 6/11/2004 3:50 AM
To: Perl Beginner Mail Group
Cc:
Subject: search and move 'expired files'



Hello all,

I want a script to move all 'expired files' to a folder.
So I wrote the script below.

However, a problem came out: the find function run everything
in the address, including the entire folders structure!!!







Thanks a lot!!!
One thing: with "-d file test", I found the perldoc of file test.
Here is my final solution.


move_expired_files.pl

#---------------move_expired_files.pl-------------------#
# written by: Koala Yeung
# usage: Inspect the inspected directory.
# Move all files, last modified before expire time,
# to the expired directory.

use File::Find;

@inspected_dir = "C:\";
$expire_time = time - 3600;
$expired_dir = "C:\temp\";

find (&action, @inspected_dir); # inspecting the inspected directory

sub action # identify expired files and move
{
my @file_stat = stat($File::Find::name);
if (($file_stat[9] < $expire_time) && (-f $File::Find::name))
{
$origin_dir = join("\", split ("/", $File::Find::name));
print "move "$origin_dir" "$expired_dir" n";
system ("move "$origin_dir" "$expired_dir"");
}
}

Wiggins D Anconia
QUOTE
Hello everyone.  I tried to post this already to googlegroups
but it seems there must be something wrong since I didnt get
any replies (maybe I did something wrong). So, here's the
deal.

I am starting to use Maketext for a Website and i have
the following situation:

Supose english is my default language so all my calls
look like this:

$out = maketext("You won [quant,_1,point]");

Now, for every different language, I want to know if
this text is not translated yet.

Right now, if that key is missing on my french lexicon
the text in english is being returned without throwing
any kind of exception.  Actually, if I understand
correctly, it is supposed to work that way.... right?


http://www.perldoc.com/perl5.8.0/lib/Local...TROLLING-LOOKUP
-FAILURE

If so, what's your advice? Would it be easy to override
the maketext method so I can log this missing entries?

Thank you very much,

Andrs


I haven't used the module personally, but according to the doc section
you noted, the default behavior shouldn't be to return the english,
*unless* the english lexicon has an _AUTO setting, in which case it will
do so.

Reference:
http://www.perldoc.com/perl5.8.0/lib/Local...l#AUTO-LEXICONS

If this doesn't help, can you post some of the code where you setup your
lexicons, and the subclasses, etc. I also assume you haven't messed
with the 'fail_with' attribute, preventing the usual 'die'? I do find
it weird that many of the examples show calling maketext with an 'or
die' idiom, which seems pointless if the default behavior on error is to
throw an exception.

Not sure what happened to your original message, it could just be none
of the resources have used the module before...

http://danconia.org

Wiggins D Anconia
QUOTE
I have some experience using perl, but I'm having a hard time finding or
building a sane perl interpreter for my particular machine.  For example,
perl -e "print 1.1" yields something like 1.108333333.  This was true both
of the 5.8.0 that came with my Red Hat 8.0 distro, and the 5.8.2 that I
built from source using defaults.  The two builds give different
results for
the "print 1.1" test, but they are both wrong.


Interesting that they provide different results, but the result provided
is not surprising, at least, if you are talking about the long decimal.

perldoc -q decimal
perldoc perlnumber

Should help explain.


QUOTE
I imagine it's quite possible that something is deeply broken in Red Hat
8.0, and I'm investigating other more recent distros.  In particular I
wonder if something about my gcc or my glibc is screwy.  But if anyone has
encountered this problem, and has ideas on how I might work around it, I'd
greatly appreciate the help!


The differing results could be caused by different compiler switches,
slight differences in gcc versions, the orientation of the earth as it
sits on its axis, etc.

QUOTE
Here is the output of myconfig for the 5.8.2 that I built (which did
compile
successfully):


If you are still concerned after reading the docs I posted above, you
should compare the perl -V output for *both* versions, see if and where
they differ. After that if you are still concerned you should take a
look through the archives for the perl5-porters list to see if you can
find info on the differences with respect to this topic for versions
5.8.0-5.8.2. And if you are still concerned post a message there, I am
sure one of them can definitely provide info.

HTH,

http://danconia.org

QUOTE
Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
Platform:
osname=linux, osvers=2.4.18-14, archname=i686-linux
uname='linux swami 2.4.18-14 #1 wed sep 4 13:35:50 edt 2002 i686 i686
i386 gnulinux '
config_args='-de'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags
='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O3',
cppflags='-fno-strict-aliasing'
ccversion='', gccversion='3.2 20020903 (Red Hat Linux 8.0 3.2-7)',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.2.93.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.2.93'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Bernard Kenik
This code should do it.

my $List = "uuuu axyzb oooo cxyzd vvvv";

my @Words = split(' ', $List);
print "@Wordsn";
my $Word;
my @xyz;
foreach $Word (@Words) {
push @xyz, $Word if $Word =~ /.*xyz.*/;
}
print "@xyz";

"Kevin Zhang" <[Email Removed]> wrote in message
news:[Email Removed]...
QUOTE

Thanks in advance for your kind help.

For the following string:

"uuuu axyzb oooo cxyzd vvvv"

What is the command to extract the substrings with "xyz" in them? In this
case, I'd like to get two strings "axyzb" and "cxyzd".




---------------------------------
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!


Deneb Meketa
Thanks for the perlnumber reference. But the problem is more severe than
just inexact numbers. I was writing about the inexact numbers because that
seemed like an easy thing to discuss :)

The more serious problems start whenever anything (including stuff in the
perl libraries) says something like:

require 5.006;

In that case, I see:

Perl v5.319.724 required--this is only v5.8.0

And that's, uh, a bit limiting.

I was wondering if the *degree* of inexactness hadn't somehow gotten a lot
worse than usual. I've never seen perl have a problem storing something
like 1.1 exactly. So I thought the "print 1.1" test was a simpler thing
that might have been indicative of the root problem. I feel like,
somewhere, something is expecting one kind of floating-point representation
and getting another.

Anyway, I'll send this query to p5p, now that I have the suggestion that
it's a reasonable kind of thing to ask there. I was originally wondering if
p5p limited itself to traffic about perl internals.

Thanks again
d.


-----Original Message-----
From: Wiggins d Anconia [mailto:[Email Removed]]
Sent: Tuesday, June 15, 2004 7:58 AM
To: Deneb Meketa; [Email Removed]
Subject: Re: I can't build a sane perl (floating-point numbers go funny)

QUOTE
I have some experience using perl, but I'm having a hard time finding or
building a sane perl interpreter for my particular machine.  For example,
perl -e "print 1.1" yields something like 1.108333333.  This was true both
of the 5.8.0 that came with my Red Hat 8.0 distro, and the 5.8.2 that I
built from source using defaults.  The two builds give different
results for
the "print 1.1" test, but they are both wrong.


Interesting that they provide different results, but the result provided
is not surprising, at least, if you are talking about the long decimal.

perldoc -q decimal
perldoc perlnumber

Should help explain.


QUOTE
I imagine it's quite possible that something is deeply broken in Red Hat
8.0, and I'm investigating other more recent distros.  In particular I
wonder if something about my gcc or my glibc is screwy.  But if anyone has
encountered this problem, and has ideas on how I might work around it, I'd
greatly appreciate the help!


The differing results could be caused by different compiler switches,
slight differences in gcc versions, the orientation of the earth as it
sits on its axis, etc.

QUOTE
Here is the output of myconfig for the 5.8.2 that I built (which did
compile
successfully):


If you are still concerned after reading the docs I posted above, you
should compare the perl -V output for *both* versions, see if and where
they differ. After that if you are still concerned you should take a
look through the archives for the perl5-porters list to see if you can
find info on the differences with respect to this topic for versions
5.8.0-5.8.2. And if you are still concerned post a message there, I am
sure one of them can definitely provide info.

HTH,

http://danconia.org

QUOTE
Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
Platform:
osname=linux, osvers=2.4.18-14, archname=i686-linux
uname='linux swami 2.4.18-14 #1 wed sep 4 13:35:50 edt 2002 i686 i686
i386 gnulinux '
config_args='-de'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags
='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O3',
cppflags='-fno-strict-aliasing'
ccversion='', gccversion='3.2 20020903 (Red Hat Linux 8.0 3.2-7)',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.2.93.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.2.93'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Wiggins D Anconia
QUOTE
Hello All,
I was wondering if there any module in perl which will let me
add dates taking care of all the complications (i.e.,) if day is greater
than 30 change month and so on.


Check CPAN for,

Date::Calc
Date::Manip

Depending on how fancy you need to get, you can also use the 'time' and
'localtime' built-ins along with some simple integer math performed in
seconds to get the same results.

http://danconia.org

Kevin Zhang
Thanks in advance for your kind help.

For the following string:

"uuuu axyzb oooo cxyzd vvvv"

What is the command to extract the substrings with "xyz" in them? In this case, I'd like to get two strings "axyzb" and "cxyzd".




---------------------------------
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!

Jeff 'Japhy' Pinyan
On Jun 16, Kevin Zhang said:

QUOTE
For the following string:

"uuuu axyzb oooo cxyzd vvvv"

What is the command to extract the substrings with "xyz" in them? In this
case, I'd like to get two strings "axyzb" and "cxyzd".

Well, you could do:

my @matches = grep /xyz/, split ' ', $string;

Let me break that up into multiple statements:

# split $string on any amount of whitespace
# @fields will be ('uuuu', 'axyzb', 'oooo', 'cxyzd', 'vvvv')
my @fields = split ' ', $string;

# now filter into @matches any element in
# @fields that matches the pattern /xyz/
# @matches will be ('axyzb', 'cxyzd')
my @matches = grep /xyz/, @fields;

--
Jeff "japhy" Pinyan [Email Removed] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
CPAN ID: PINYAN [Need a programmer? If you like my work, let me know.]
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.

Kevin Zhang
Thank you so much (and for the tip too). It works great!

One more question, how do I strip out all letters before "xyz". For the original example, how would I get "xyzb" and "xyzd"?

Thanks again,
Kevin

David Dorward <[Email Removed]> wrote:
Tip: This is a beginners list, therefore many questions will be simple.
Aim for more descriptive subject lines and life will be easier for
users of the list archives.

On 16 Jun 2004, at 17:10, Kevin Zhang wrote:
QUOTE
For the following string:

"uuuu axyzb oooo cxyzd vvvv"

What is the command to extract the substrings with "xyz" in them? In
this case, I'd like to get two strings "axyzb" and "cxyzd".

The useful functions here are "grep" and "split" (perdoc -f grep and so
on).

#!/usr/bin/perl

use strict;
use warnings;

my $string = "uuuu axyzb oooo cxyzd vvvv";

my @list_of_words = split / /, $string;

my @list_of_words_containing_xyz = grep /xyz/, @list_of_words;

foreach my $word (@list_of_words_containing_xyz) {
print $word, "n";
}

or, in less verbose form:

foreach (grep(/xyz/,split(/ /, "uuuu axyzb oooo cxyzd vvvv"))) { print
$_, "n"; }

--
David Dorward




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





---------------------------------
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.

Roberts Mr Richard L
URL?


thanks in advance

Richard L. Roberts
Systems Integrator
Marine Corps Community Services
3044 Catlin Ave.
Quantico, Va. 22134
Phone:
Fax:
Email: [Email Removed]


-----Original Message-----
From: Ciemny, Jessica [mailto:[Email Removed]]
Sent: Wednesday, June 16, 2004 9:01 AM
To: [Email Removed]
Subject: Helpful Regular Expression Tool


I am not sure if anyone has ever mentioned this before, but I wanted to
share something with you that I have recently found that might be of great
assistance with many of your "RegEx" issues.

The name of this program is, "The Regex Coach". I have found it to be an
invaluable tool to any regular expression building that I attempt to create.
Input the information you are attempting to match in one pane of the window,
then build your regular expression in the other pane, and watch how your
expression matches up as you build it.

Keep in mind that you still have to know the rules of regular expressions to
build them. "The Regex Coach" does not build them for you; it just shows you
how your regular expressions match up with the data that you supply it.

Try it, it may or may not be helpful for you.

Jessica Ciemny
Sr. Unix System Administrator

Global Information Technology
________________________________________
LSG Sky Chefs International, L.L.C.
Global Information Services, Americas Data Center
1950 N Stemmons Fwy.
Suite 2023
Dallas, TX 75027
United States of America
Phone: +
Fax: +
Mobile: +
E-mail: [Email Removed]
________________________________________
http://www.lsg-skychefs.com


This electronic message transmission contains information from the Company
LSG Sky Chefs or one of its affiliates which may be confidential or
privileged. The information is intended to be for the use of the individual
or entity named above. Any views or opinions presented are solely those of
the author and do not necessarily represent those of LSG Sky Chefs.

If you are not the intended recipient, be aware that any disclosure,
copying, distribution or use of the contents of this information is
prohibited.

If you have received this electronic transmission in error, please notify us
by telephone or by electronic mail immediately.


--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

Jeff 'Japhy' Pinyan
On Jun 16, Kevin Zhang said:

QUOTE
One more question, how do I strip out all letters before "xyz". For the
original example, how would I get "xyzb" and "xyzd"?

I would suggest this slightly modified grep():

my @matches =
grep { /(xyz.*)/ and ($_ = $1) }
split ' ', $string;

Here, instead of just making sure the fragment has 'xyz' in it, we're
capturing the 'xyz' and everything after it into $1, and then setting $_
equal to $1.

--
Jeff "japhy" Pinyan [Email Removed] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
CPAN ID: PINYAN [Need a programmer? If you like my work, let me know.]
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.

In a message dated 6/16/2004 12:10:54 PM Eastern Daylight Time,
[Email Removed] writes:
QUOTE
Thanks in advance for your kind help.

For the following string:

"uuuu axyzb oooo cxyzd vvvv"

What is the command to extract the substrings with "xyz" in them? In this
case, I'd like to >get two strings "axyzb" and "cxyzd".


Untested:

my $t = 'uuuu axyzb oooo cxyzd vvvv';
my @matched = ($t =~ /([^ ]*xyz[^ ]*)/g);


-will
http://www.wgunther.tk
(the above message is double rot13 encoded for security reasons)

Most Useful Perl Modules
-strict
-warnings
-Devel::DProf
-Benchmark
-B::Deparse
-Data::Dumper
-Clone
-Perl::Tidy
-Beautifier
-DBD::SQLite

David Dorward
Tip: This is a beginners list, therefore many questions will be simple.
Aim for more descriptive subject lines and life will be easier for
users of the list archives.

On 16 Jun 2004, at 17:10, Kevin Zhang wrote:
QUOTE
For the following string:

"uuuu axyzb oooo cxyzd vvvv"

What is the command to extract the substrings with "xyz" in them? In
this case, I'd like to get two strings "axyzb" and "cxyzd".

The useful functions here are "grep" and "split" (perdoc -f grep and so
on).

#!/usr/bin/perl

use strict;
use warnings;

my $string = "uuuu axyzb oooo cxyzd vvvv";

my @list_of_words = split / /, $string;

my @list_of_words_containing_xyz = grep /xyz/, @list_of_words;

foreach my $word (@list_of_words_containing_xyz) {
print $word, "n";
}

or, in less verbose form:

foreach (grep(/xyz/,split(/ /, "uuuu axyzb oooo cxyzd vvvv"))) { print
$_, "n"; }

--
David Dorward
<http://dorward.me.uk/>
<http://blog.dorward.me.uk/>

Bruce Ferrell
Google took here:

http://www.weitz.de/regex-coach/

Roberts Mr Richard L wrote:
QUOTE
URL?


thanks in advance

Richard L. Roberts
Systems Integrator
Marine Corps Community Services
3044 Catlin Ave.
Quantico, Va. 22134
Phone:
Fax:
Email: [Email Removed]


-----Original Message-----
From: Ciemny, Jessica [mailto:[Email Removed]]
Sent: Wednesday, June 16, 2004 9:01 AM
To: [Email Removed]
Subject: Helpful Regular Expression Tool


I am not sure if anyone has ever mentioned this before, but I wanted to
share something with you that I have recently found that might be of great
assistance with many of your "RegEx" issues.

The name of this program is, "The Regex Coach". I have found it to be an
invaluable tool to any regular expression building that I attempt to create.
Input the information you are attempting to match in one pane of the window,
then build your regular expression in the other pane, and watch how your
expression matches up as you build it.

Keep in mind that you still have to know the rules of regular expressions to
build them. "The Regex Coach" does not build them for you; it just shows you
how your regular expressions match up with the data that you supply it.

Try it, it may or may not be helpful for you.

Jessica Ciemny
Sr. Unix System Administrator

Global Information Technology
________________________________________
LSG Sky Chefs International, L.L.C.
Global Information Services, Americas Data Center
1950 N Stemmons Fwy.
Suite 2023
Dallas, TX 75027
United States of America
Phone: +
Fax: +
Mobile: +
E-mail: [Email Removed]
________________________________________
http://www.lsg-skychefs.com


This electronic message transmission contains information from the Company
LSG Sky Chefs or one of its affiliates which may be confidential or
privileged. The information is intended to be for the use of the individual
or entity named above. Any views or opinions presented are solely those of
the author and do not necessarily represent those of LSG Sky Chefs.

If you are not the intended recipient, be aware that any disclosure,
copying, distribution or use of the contents of this information is
prohibited.

If you have received this electronic transmission in error, please notify us
by telephone or by electronic mail immediately.



Wiggins D Anconia
Please bottom post...

QUOTE
Ah good point, I believe I forgot the line:

$days_in_month[1] = 29 if $printed_year % 4 == 0;

Better?  If not apologies, not sure why that would be :)


Sort of, now it breaks every 100, 400, 1600? years. This is where the
argument for using a ready made module comes into play. As ironic as it
is, calendars, dates, and times are incredibly complex, probably because
humans devised them, so you are better off letting someone who has
researched and specifically developed the functions to take into account
all of the little quirks provide the code, especially since it is free
and open.

Won't even go into the english only aspects of it, or that it is a
single kind of calendar.

They are sort of like e-mail that way....

http://danconia.org

QUOTE
-----Original Message-----
From: Wiggins d'Anconia [mailto:[Email Removed]]
Sent: 16 June 2004 01:18
To: [Email Removed]
Cc: [Email Removed]; 'Mandar Rahurkar'
Subject: Re: Time

Your script appears to break every 4th year....

http://danconia.org

Chris Welch wrote:
The attached text file is an example of a calendar I've used for CGI
purposes (I should point out this is not entirely my script, it's
modified by me but the original was by a friend of mine.)


-----Original Message-----
From: Mandar Rahurkar [mailto:[Email Removed]]
Sent: 15 June 2004 23:22
Cc: [Email Removed]
Subject: Time

Hello All,
I was wondering if there any module in perl which will
let

me

add dates taking care of all the complications (i.e.,) if day is

greater

than 30 change month and so on.

Thanks,
Mandar


------------------------------------------------------------------------

#! C:webperlbinperl.exe

require("../admin/mkttl.conf");

use CGI;
use Time::Local; ## from DMYHMS to epoch

$q = new CGI;

(my $true_sec, my $true_min, my $true_hour, my $true_mday, my
$true_mon,
my $true_year, my $true_wday, my $true_yday, my $true_isdst) =
localtime(time);

$days_in_month[0] = 31;
$days_in_month[1] = 28;
$days_in_month[2] = 31;
$days_in_month[3] = 30;
$days_in_month[4] = 31;
$days_in_month[5] = 30;
$days_in_month[6] = 31;
$days_in_month[7] = 31;
$days_in_month[8] = 30;
$days_in_month[9] = 31;
$days_in_month[10] = 30;
$days_in_month[11] = 31;

$months[0] = 'January';
$months[1] = 'February';
$months[2] = 'March';
$months[3] = 'April';
$months[4] = 'May';
$months[5] = 'June';
$months[6] = 'July';
$months[7] = 'August';
$months[8] = 'September';
$months[9] = 'October';
$months[10] = 'November';
$months[11] = 'December';

$days[0] = 'Sunday';
$days[1] = 'Monday';
$days[2] = 'Tuesday';
$days[3] = 'Wednesday';
$days[4] = 'Thursday';
$days[5] = 'Friday';
$days[6] = 'Saturday';

# The calendar
$mon = ($q->param("month") - 1);
$year = ($q->param("year")) if ($q->param("year"));
$year = $true_year if ($year eq ""); # Use today's date if none are
specified
$mon = $true_mon if ($mon == -1);

$todays_day_of_month = $true_mday if ($true_mon eq $mon &&
$true_year eq
$year);

my $first_day_of_month_epoch = timelocal(1, 0, 0,1, $mon, $year);
(my $sec, my $min, my $hour, my $mday, my $mon, my $year, my $wday,
my
$yday, my $isdst) = localtime($first_day_of_month_epoch);

$inset_month = $wday - 1;
$inset_month = 6 if ($inset_month < 0);

print "<table border='0' cellspacing='1' cellpadding='1'
class='calendar' align='right'
<tr
  <td colspan='7' align='center' class='cal_head'
  <table border='0' width='100%' cellpadding='0'
cellspacing='0' class='month_header'><tr><td width='10'
align='left'><b><a
class='bold' href='";

## define previous and next months and years
$prev_month = $mon;
$prev_year = $year;

if ($prev_month eq 0) {
$prev_month = 12;
$prev_year--;
}

$next_month = ($mon+2);
$next_year = $year;

if ($next_month eq 13) {
$next_month = 1;
$next_year++;
}

print

"main.cgi?month=".$prev_month."&year=".$prev_year."'>&laquo;</a></b></td
<
td width='*' align='center'><a class='bold'
href='main.cgi'>".$months[$mon]." ".($year + 1900)."</a></td><td
width='10' align='right'><b><a class='bold'

href='main.cgi?month=".$next_month."&year=".$next_year."'>&raquo;</a></b
<
/td></tr></table
  </td
</tr
<tr
  <td class='day_of_week'>M</td
  <td class='day_of_week'>T</td
  <td class='day_of_week'>W</td
  <td class='day_of_week'>T</td
  <td class='day_of_week'>F</td
  <td class='day_of_week'>S</td
  <td class='day_of_week'>S</td
</tr>n";

$day_position_counter = 0;
$day_number_counter = 1;
$final_day_number = $days_in_month[$mon];

## first create inset
$i = 0;
while ($i < $inset_month){
print " <tr>n" if $day_position_counter == 0;
print "  <td>&nbsp;</td>n";
$day_position_counter++;
$i++;
}

## now create main section
while ($day_number_counter <= $final_day_number){
## setup todays info
$todays_epoch_date = timelocal(0, 0, 12, ($day_number_counter),
$mon, $year);

print " <tr>n" if $day_position_counter == 0;

if ($todays_day_of_month eq $day_number_counter){
  print "  <td
class='today'>".$day_number_counter."</td>n";
} else {
  print "  <td>".$day_number_counter."</td>n";
}

$day_position_counter++;

if ($day_position_counter == 7){
      $day_position_counter = 0;
  print " </tr>n";
}

$day_number_counter++;
}

## now finish off the row if necessary
while ($day_position_counter){
print "  <td class='blank_date'>&nbsp;</td>n";
$day_position_counter++;

if ($day_position_counter == 7){
  $day_position_counter = 0;
  print " </tr>n";
}
}

print "</table>nn";
print "</body>nn";
print "</html>n";

exit;




--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]
<http://learn.perl.org/> <http://learn.perl.org/first-response




Roberto Etcheverry
Look for 'Playing with STDIN and STDOUT' and 'Re-Opening Files (dups)'
in perlopentut .


Wagner, David --- Senior Programmer Analyst --- WGO said the following
on 6/16/2004 2:09 PM:

QUOTE
I have a Perl process which runs on solaris under 5.8.3. It is started with the following command:
  su - prlusr -c "/usr/bin/perl -w /d/src/plpoll.pl >> /d/audit/`date '+%y%m%d'`.out 2>&1 &"

I would like to a daily basis at time switchover and after I have completed my processing, check to see if the audit log file exists(ie, I would pull in the latest time and see if the file say for the 16 Jun: /d/audit/040616.out exists. If it does not, then I want to close output to the current log file and reopen.

What I want to replicate is:

/d/src/plpoll.pl >> /d/audit/`date '+%y%m%d'`.out 2>&1

Does the above translate to:

close(STDOUT);
close(STDERR);
then
open(STDOUT, '>>' . $MyNewLog)
open(STDERR, '>>' . $MyNewLog)

There would be error checking on both opens.  Are those closes and opens what is needed? if not, ay assistance would be appreciated?  Note: At this point, I don't have a test box so trying to get a good idea of what is needed before trying to make the changes and insute the processing continues as it should.

Thanks.

Wags ;)


*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************





Wiggins D Anconia
Please group reply...

QUOTE
before chomping the find command did not work as the
extracted username has a end of line(or somthing I
donno). I gave a email before this and expecting you
mail to get me out of trouble.Thank you.


chomp($Hme);
chomp($user);

perldoc -f chomp

If you are going to chomp something it should be $line
not these two.


Very odd that $user would have had a newline (record separator) on it,
unless it is the last thing on the line, which would be weird as well.

Normally 'chomp' is only used to remove newlines, and so the only thing
you should have neeeded it on would be $line since it contains the whole
line.

http://danconia.org

If the enduser programmer want to force it into scalar context they can:
print scalar fooyou();

-will
http://www.wgunther.tk
(the above message is double rot13 encoded for security reasons)

Most Useful Perl Modules
-strict
-warnings
-Devel::DProf
-Benchmark
-B::Deparse
-Data::Dumper
-Clone
-Perl::Tidy
-Beautifier
-DBD::SQLite

In a message dated 6/17/2004 5:32:16 PM Eastern Standard Time,
[Email Removed] writes:
QUOTE
I knew about that but the problem is most of the users (incuding myself
;p) will want to print it without the same $header info twice and don't
want to have a bunch of print scalar whatevr();

If there is no way to tell if fooyou() was called in 'print context'
then we'll just use scalar, but I was hoping there was a way to tell...

like this would be super nice if such a beast as wantprint existed...

return "$header$data1$data2" if wantprint;
return ("$header$data1","$header$data2") if wantarray;
return "$header$data1$data2";

There is no such thing as print context. As it says in perlfunc
"Because print takes a LIST, anything in the LIST is evaluated in list
context, and any subroutine that you call will have one or more of its expressions
evaluated in list context."

-will
http://www.wgunther.tk
(the above message is double rot13 encoded for security reasons)

Most Useful Perl Modules
-strict
-warnings
-Devel::DProf
-Benchmark
-B::Deparse
-Data::Dumper
-Clone
-Perl::Tidy
-Beautifier
-DBD::SQLite

Jupiterhost.Net
[Email Removed] wrote:

QUOTE
If the enduser programmer want to force it into scalar context they can:
print scalar fooyou();

I knew about that but the problem is most of the users (incuding myself
;p) will want to print it without the same $header info twice and don't
want to have a bunch of print scalar whatevr();

If there is no way to tell if fooyou() was called in 'print context'
then we'll just use scalar, but I was hoping there was a way to tell...

like this would be super nice if such a beast as wantprint existed...

return "$header$data1$data2" if wantprint;
return ("$header$data1","$header$data2") if wantarray;
return "$header$data1$data2";

Damian Scott
I am new to using Perl and found this module out at CPAN to read gzip'ped
files, but I have no idea how to use it. Can someone provide a couple of
examples to get me started? TIA.


-Damian


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.