Elegant!
On Feb 11, 2008 1:35 PM, John W. Krahn [EMAIL PROTECTED] wrote:
Johnson, Reginald (GTI) wrote:
I have two input files and I put each into a hash. If the key of one
hash matches the other then I output some values from both. I have
accomplished the output that I want but I want to
Chas. Owens wrote:
If you want to print out only pairs you can use the code below. If
you want to print out all of the items in the the longer array, then
change the = to =
In that case you'd better prevent Perl from spitting out uninitialized
warnings...
#!/usr/bin/perl
use strict;
use
Apparently, you are rewriting the value of the @alphaid and @betaid arrays
on each of the loops after the s///.
What are you trying to do with:
@alphaid = $line;
push(@alphaid,$_);
I'd try only:
push(@alphaid, $line);
if I understood correctly.
Cheers,
David.
On Feb 11, 2008 3:11 PM, [EMAIL
I am sure there are better ways as I am learning as well, but how
about doing something like this. This is assuming both arrays have the
same number of elements.
open MYFILE, f1.txt;
for (0..$#alpha) {
print MYFILE $alphaid[$_]\t;
print MYFILE $betaid[$_]\n;
}
On Feb 11, 2008 12:11 PM,
On 2/11/08, Michael Barnes [EMAIL PROTECTED] wrote:
I thought about using lstat to get the size of a file for file
comparisons. I see that lstat always returns a list of thirteen values.
The references I find appear to require assignment of those 13 values
to variables, even though I only
Chas. Owens wrote:
On Feb 11, 2008 4:17 PM, Michael Barnes [EMAIL PROTECTED] wrote:
I thought about using lstat to get the size of a file for file
comparisons. I see that lstat always returns a list of thirteen values.
The references I find appear to require assignment of those 13 values
to
I'd probably do it as:
s/(\..*?)\z//;
Cheers,
D.
On Feb 11, 2008 7:14 AM, [EMAIL PROTECTED] wrote:
Hi All,
I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
that I want to remove last dot (.) and all the characters/digit after
that dot with the help of regular
-Original Message-
From: Chas. Owens [mailto:[EMAIL PROTECTED]
Sent: Monday, February 11, 2008 13:21
To: Michael Barnes
Cc: beginners@perl.org
Subject: Re: lstat and its uses
On Feb 11, 2008 4:17 PM, Michael Barnes [EMAIL PROTECTED] wrote:
I thought about using lstat to get the
Martin Barth schreef:
Allam Reddy, Thomas:
I have a string jdbc/abc.xml which I wanted to tokenize using the
delimiter /
May I know the perl code for this?
you could use split in this situation.
@tokens = split(/\//, $string);
the frist parameter to split is a regular expression with an
[EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
that I want to remove last dot (.) and all the characters/digit after
that dot with the help of regular expression.
If after last dot(.) there are three digit then don't do
[EMAIL PROTECTED] wrote:
From: John W. Krahn [mailto:[EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
that I want to remove last dot (.) and all the characters/digit after
that dot with the help of regular expression.
$
Hi,
I am trying to install Sys::Gamin in a CentOS 5 machine but I am getting a
lot of errors at the `make` stage. The errors are from a C file and I am not
versed in C :-( There is an initial error from `perl Makefile.PL`:
# perl Makefile.PL
Ignore Not a known parameter name warnings.
Checking
To reuse some code...
$ perl -le'
$_ = D.PRS.WEB.02.10.001.1;
print;
s/\.[^.]{0,2}\z//;
s/\.[^.]{4,}\z//;
print;
'
Will replace 0 to 2 or more than 3 characters with
To get digits and not any character except a dot(.) replace [^.]
with [0-9] or the equivalents: \d and [:digits:]
--
To
On Feb 11, 2008 4:18 AM, Rajendra kumar chauhan [EMAIL PROTECTED] wrote:
I WANT TO CREATE A WEB INTERFACE FOR A SOFTWARE CALLED BLAT USING CGI AND I
HAVE DOWNLAODED AND INSTALLED APACHE WEB BROWSER FOR IT BUT I DONT KNOW HOW
TO GO AHEAD,PLEASE ASSIST ME
You may find reading the CGI* perldoc
FYI
Caps lock is considered impolite.
On Feb 11, 2008 1:18 AM, Rajendra kumar chauhan [EMAIL PROTECTED] wrote:
I WANT TO CREATE A WEB INTERFACE FOR A SOFTWARE CALLED BLAT USING CGI AND I
HAVE DOWNLAODED AND INSTALLED APACHE WEB BROWSER FOR IT BUT I DONT KNOW HOW
TO GO AHEAD,PLEASE ASSIST ME
Allam Reddy, Thomas [EMAIL PROTECTED] asked:
I have a string jdbc/abc.xml which I wanted to tokenize
using the delimiter /
May I know the perl code for this?
my $string = 'jdbc/abc.xml';
my @tokens = split /\//, $string;
print 'Tokens: ' , join( ',', @tokens ), \n;
HTH,
Thomas
--
To
On Feb 11, 2008 4:47 PM, John W. Krahn [EMAIL PROTECTED] wrote:
lstat $filename;
my $size = -s _;
Did you mean:
my $size = -s $_;
?
--
David Moreno - http://www.damog.net/
Yes, you can.
But where's the fun then? :)
On Feb 11, 2008 4:09 PM, Dr.Ruud [EMAIL PROTECTED] wrote:
Or not code a regex at all, and use a module like File::Basename or
File::Spec.
--
David Moreno - http://www.damog.net/
Yes, you can.
You are missing the FAM header files.
On some Linux distros, that might be installed as libfam-dev package, not
sure on FC4 though.
Cheers,
David.
On Feb 11, 2008 12:17 PM, Dermot [EMAIL PROTECTED] wrote:
Hi,
I am trying to install Sys::Gamin in a CentOS 5 machine but I am getting a
lot of
Hi,
I am learning to print two arrays in a single file but unable to
do. So, I am printing it in two files. Any ideas
# Populating the arrays @alphaid and @betaid
foreach my $line (@File1)
{
if ($line =~ /^AC/)
{
$line =~ s/^AC\s*//;
@alphaid =
Michael Barnes wrote:
I thought about using lstat to get the size of a file for file
comparisons. I see that lstat always returns a list of thirteen values.
The references I find appear to require assignment of those 13 values
to variables, even though I only want to use one.
Do I really have
Johnson, Reginald (GTI) wrote:
I have two input files and I put each into a hash. If the key of one
hash matches the other then I output some values from both. I have
accomplished the output that I want but I want to know if it can be done
in a more efficient manner.
Yes.
#!/usr/bin/perl
use
On Feb 11, 2008 4:17 PM, Michael Barnes [EMAIL PROTECTED] wrote:
I thought about using lstat to get the size of a file for file
comparisons. I see that lstat always returns a list of thirteen values.
The references I find appear to require assignment of those 13 values
to variables, even
On Feb 11, 2008 3:11 PM, [EMAIL PROTECTED] wrote:
Hi,
I am learning to print two arrays in a single file but unable to
do. So, I am printing it in two files. Any ideas
# Populating the arrays @alphaid and @betaid
foreach my $line (@File1)
{
if ($line =~ /^AC/)
On Feb 11, 2008 4:39 PM, John W. Krahn [EMAIL PROTECTED] wrote:
Chas. Owens wrote:
On Feb 11, 2008 4:17 PM, Michael Barnes [EMAIL PROTECTED] wrote:
I thought about using lstat to get the size of a file for file
comparisons. I see that lstat always returns a list of thirteen values.
The
I thought about using lstat to get the size of a file for file
comparisons. I see that lstat always returns a list of thirteen values.
The references I find appear to require assignment of those 13 values
to variables, even though I only want to use one.
Do I really have to put
I have two input files and I put each into a hash. If the key of one
hash matches the other then I output some values from both. I have
accomplished the output that I want but I want to know if it can be done
in a more efficient manner.
#!/usr/bin/perl
use strict;
use warnings;
That is very interesting, actually. What piece of documentation should I
read to learn about this operators?
Thanks.
David.
On Feb 11, 2008 6:14 PM, Kashif Salman [EMAIL PROTECTED] wrote:
Perl already has all the info from the previous lstat command, using _
is more efficient in that it
Thanks John. OOps I did not mentioned one condition while writing the
regular expression.
condition is : If after last dot(.) there are three digit then don't do
anything but if after last dot(.) there are no exactly three digit then
replace that dot(.) and all digits after that dot with space.
Perl already has all the info from the previous lstat command, using _
is more efficient in that it doesn't have to do another system call.
On Feb 11, 2008 2:06 PM, David Moreno [EMAIL PROTECTED] wrote:
On Feb 11, 2008 4:47 PM, John W. Krahn [EMAIL PROTECTED] wrote:
lstat $filename;
my
Kashif Salman wrote:
On Feb 11, 2008 3:51 PM, Gunnar Hjalmarsson [EMAIL PROTECTED] wrote:
[ Please stop this top-posting!!
snip
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
On Feb 11, 2008 3:51 PM, Gunnar Hjalmarsson [EMAIL PROTECTED] wrote:
[ Please stop this top-posting!! And David, you'd better ask your Perl
questions of general interest to the list. ]
Kashif Salman wrote:
David Moreno wrote:
Kashif Salman wrote:
David Moreno wrote:
On Feb 11, 2008
[ Please stop this top-posting!! And David, you'd better ask your Perl
questions of general interest to the list. ]
Kashif Salman wrote:
David Moreno wrote:
Kashif Salman wrote:
David Moreno wrote:
On Feb 11, 2008 4:47 PM, John W. Krahn [EMAIL PROTECTED] wrote:
lstat $filename;
my $size =
-Original Message-
From: Kashif Salman [mailto:[EMAIL PROTECTED]
Sent: Monday, February 11, 2008 15:24
To: David Moreno
Cc: John W. Krahn; Perl Beginners
Subject: Re: lstat and its uses
I am not sure how to bring it up using the perldoc, I read it when I
was going through the
On 12:33:09 11/02/2008 Allam Reddy, Thomas [EMAIL PROTECTED] wrote:
Hi All,
I have a string jdbc/abc.xml which I wanted to tokenize using the
delimiter /
May I know the perl code for this?
Thanks
Thomas Reddy
hi,
you could use split in this situation.
@tokens = split(/\//, $string);
no matter where i use:
$menu-entryconfigure(#,disabled);
i get:
Can't locate object method entryconfigure via package
Tk::Menu::Cascade
unless i use it on a non-existent $menu, in which case i get:
Can't call method entryconfigure on an undefined value
Also, if i add a -command in a
[EMAIL PROTECTED] wrote:
Hi,
Hello,
I am learning to print two arrays in a single file but unable to
do. So, I am printing it in two files. Any ideas
Instead of using two arrays just use one Array of Arrays.
# Populating the arrays @alphaid and @betaid
foreach my $line (@File1)
I'm pretty sure all sane user and admin tools forbid this,
although if you edit /etc/passwd (shadow?) directly, you deserve
your BOFH award. :)
Thanks everyone for your input and i used successfully chown/chmod in
my routines as provided by John Krahn.
Yes, it is username and not the uid!!
Hi All,
I have a string jdbc/abc.xml which I wanted to tokenize using the
delimiter /
May I know the perl code for this?
Thanks
Thomas Reddy
[EMAIL PROTECTED] wrote:
Hi All,
Hello,
I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
that I want to remove last dot (.) and all the characters/digit after
that dot with the help of regular expression.
$ perl -le'
$_ = D.PRS.WEB.02.10.001.1;
print;
s/\.[^.]*\z//;
Hi All,
I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
that I want to remove last dot (.) and all the characters/digit after
that dot with the help of regular expression.
Please help.
Regards
Irfan.
Project Lead
TSINDIA - Production Line
Individual Software Solutions
I WANT TO CREATE A WEB INTERFACE FOR A SOFTWARE CALLED BLAT USING CGI AND I
HAVE DOWNLAODED AND INSTALLED APACHE WEB BROWSER FOR IT BUT I DONT KNOW HOW
TO GO AHEAD,PLEASE ASSIST ME
I am not sure how to bring it up using the perldoc, I read it when I
was going through the book Learning Perl. Maybe someone else here
can point out how to find it in perldoc..
On Feb 11, 2008 3:16 PM, David Moreno [EMAIL PROTECTED] wrote:
That is very interesting, actually. What piece of
43 matches
Mail list logo