On Sat, Jun 14, 2008 at 1:05 PM, Octavian Rasnita <[EMAIL PROTECTED]> wrote:
> From: "Xavier Noria" <[EMAIL PROTECTED]>> On Sat, Jun 14, 2008 at 9:56 AM,
> Octavian Rasnita <[EMAIL PROTECTED]> wrote:
>>
>>> Is there a one-liner command that can
On Sat, Jun 14, 2008 at 9:56 AM, Octavian Rasnita <[EMAIL PROTECTED]> wrote:
> Is there a one-liner command that can replace a certain text with another in
> more files specified with wildcards like *.html that works under Windows
> cmd?
Since you ask this you probably know the Windows shell does
On Wed, May 21, 2008 at 4:20 PM, Remy Guo <[EMAIL PROTECTED]> wrote:
> it's really interesting... then how can i match that ^M using regex?
> i've tried "chomp" when reading each line but it doesn't work...
That's "\r" everywhere except in Macs before Mac OS X. Some programs
display "\r" as "^M"
On Apr 20, 2008, at 22:45 , Levente Kovacs wrote:
Thank you very much for your answer. I am sitting here for a day
seeng what
could be wrong, but I can't find it. I post a link to my code here.
Thank you
for your help in advance.
http://logonex.eu/cgi-bin/viewvc/viewvc.cgi/scripts4geda/dbub
On Apr 20, 2008, at 21:57 , Levente Kovacs wrote:
Can anyone tell me what this error message mean?
syntax error at ./dbubdate.pl line 181, near "}continue"
The code around that line in that script is not well-formed. If you
don't know what to do please send lines 170 to 190 specifying which
On Apr 10, 2008, at 18:24 , Jonathan Mast wrote:
Hi, I have a ~125MB file of which I want to read lines n thru n+x
and write
those into a separate file. What is the best way to go about this?
Tie::File
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PRO
On Mar 17, 2008, at 11:51 , [EMAIL PROTECTED] wrote:
How is it possible to initialize variable using 0 or '' and not having
undef warning later on using them?
Not reassigning to undef.
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
htt
On Dec 11, 2007, at 9:53 PM, ciwei2103 wrote:
Give a disk sequence know that is incrementing with base 16, such
as ,
0001
0003
0004
0008
0009
000A
000B
000F
0010
0011
how do I extract the a subset that is have at least 4 consecutives,
such as "0008 0009 000A 000B"
Sorry, the previous code
On Dec 11, 2007, at 9:53 PM, ciwei2103 wrote:
Give a disk sequence know that is incrementing with base 16, such
as ,
0001
0003
0004
0008
0009
000A
000B
000F
0010
0011
how do I extract the a subset that is have at least 4 consecutives,
such as "0008 0009 000A 000B"
I hope this has to do wi
On Nov 29, 2007, at 2:06 AM, Xavier Noria wrote:
Indeed, the iterator provided by Algorithm::Combinatorics is faster
only for lists of sizes >= 7. (And gets to be twice as fast for size
16.)
Certainly there's room for improvement here.
For the archives, I copied the iterator
On Nov 28, 2007, at 10:37 PM, Xavier Noria wrote:
On Nov 28, 2007, at 9:54 PM, Xavier Noria wrote:
On Nov 28, 2007, at 8:58 PM, yitzle wrote:
In a personal email conversation, he realized what he was actually
looking for is the power set.
List::PowerSet
http://search.cpan.org/~nikc/List
On Nov 28, 2007, at 9:54 PM, Xavier Noria wrote:
On Nov 28, 2007, at 8:58 PM, yitzle wrote:
In a personal email conversation, he realized what he was actually
looking for is the power set.
List::PowerSet
http://search.cpan.org/~nikc/List-PowerSet-0.01/lib/List/PowerSet.pm
If speed is an
On Nov 28, 2007, at 8:58 PM, yitzle wrote:
In a personal email conversation, he realized what he was actually
looking for is the power set.
List::PowerSet
http://search.cpan.org/~nikc/List-PowerSet-0.01/lib/List/PowerSet.pm
If speed is an issue Algorith::Combinatorics provides subsets() in XS:
On Nov 8, 2007, at 9:33 PM, C.R. wrote:
I run a script on unix Perl to write a text file. By default, when
Perl
writes "\n" it writes a line ending sequence which is native to the
current OS. How do I force this particular script to always write DOS
CRLF line endings?
A good approach is to h
On Sep 27, 2007, at 1:29 AM, Mahurshi Akilla wrote:
Is there a way in perl to peek the next line in the file while keeping
the line pointer the same?
I want to do something like this:
while ()
{
//do some stuff
//?? peek next line ?? and enter conditional block//
//do some more
On Sep 11, 2007, at 10:05 PM, Gerald Wheeler wrote:
Correct
That can be done with a one-liner:
perl -0777 -pi.bak -e '$_ = q{new text goes here}' *.txt
The options -p, -i, and -e are documented in perlrun. The flag -0777
has the side-effect of slurping the whole file into $_ (one file at
On Sep 11, 2007, at 9:43 PM, Gerald Wheeler wrote:
I have about 400 text files I need to replace the contents. All files
are in the current directory as the perl script runs out of
my $newText = "This is my new text.. anybody's text goes here";
open(INFILE, $plants)
while (<>)
{
print $ne
On Sep 7, 2007, at 10:07 AM, Santana wrote:
Hei all,
i'am a newbie in PERL and i find a solution for this problem :
I have a string "xxx" , i want put ones("1") on left of string, if
this string dont have a length of 20 character.
Example :
if i have th string "HELLO" and woul like get
Those ^Ms are "\015"s, which is "\r" practically everywhere. Note
that line-oriented scripts "almost" work on CRLF text files on Unix
because CRLF has a trailing "\n" by chance. I think this is
unfortunate because instead of just breaking your program there's
the annoying situation where y
On Aug 27, 2007, at 1:29 PM, Chas Owens wrote:
Bad idea*, at least until Perl 5.10 (and maybe not even then).
Well, it may or may not be a bad idea.
On the one hand that performance penalty may be negligible for the OP
problem and thus it just does not matter. On the other hand your
solut
On Aug 27, 2007, at 10:59 AM, Petra Vide Ogrin wrote:
Hi all,
I have a hash and some prose text and want my perl to identify the
keys of
the hash in this text and replace them with the corresponding
values of
the keys.
I tried the following
foreach (keys %expan) {
if ($sbl =~ m/$_/g) {
On Aug 26, 2007, at 3:52 PM, Peter Scott wrote:
The term "strong typing" is so ill-defined as to make this an
angels-dancing-on-a-pinhead discussion and unlikely to lead to any
enlightenment. Even the Wikipedia definition says that there *is* no
accepted definition and some of the common usages
On Aug 26, 2007, at 3:22 AM, Randal L. Schwartz wrote:
Perl is a very strongly typed language. The problem is that people
keep
thinking "number" or "string" is a type in Perl. It isn't. The
type is
called "scalar". Other types are "array" and "hash" and
"filehandle" and
"dirhandle" and
On Aug 25, 2007, at 4:53 PM, Yoyoyo Yoyoyoyo wrote:
Thanks, but quick question. If I do it from the command line it
works fine. But if I add:
`perl -pi -we 's/\n/\r\n/' ./student.csv`;
to my perl script it doesn't make the change to the file. Is there
a reason for this?
Sure, the lite
On Aug 25, 2007, at 4:54 AM, Yoyoyo Yoyoyoyo wrote:
I use a mac and I was wondering if there was a way to convert unix
newlines in a text file to dos newlines.
Yeah, with a Perl one-liner it would be
perl -pi -we 's/\n/\r\n/' file.txt
or
perl -pi.bak -we 's/\n/\r\n/' file.txt
if you w
On Aug 24, 2007, at 8:13 PM, Dr.Ruud wrote:
"Chas Owens" schreef:
[$db_initiali.ed]
Unless you have some funky source filter installed that normalizes
spelling variants Perl is going to have a problem.
Yes, I like the idea:
use autocorect;
I think there's an Acme:: module that did somet
On Aug 24, 2007, at 11:58 AM, Sundeep Gupta wrote:
The problem was that this module (XYZ) module uses another module,
which
again has the use statement to load XYZ. I don't know if the perl
loads the
module again and might be this caused to reset the value back to 0.
When I commented the use
On Aug 21, 2007, at 3:37 PM, infobank wrote:
I'm trying to embed djabberd (perl5 net-im) onto a m0n0wall base
(FreeBSD). I found scandeps, and ran it on DJAbberd and found some
useful information about the modules it relies upon.
Is there any way to find out which files it relies upon?
You me
On Aug 16, 2007, at 11:47 AM, Sayed, Irfan (Irfan) wrote:
I have one array which stores some data after executing specific
command. Depends on situation , command has different output at
different time. sometime array may store 4 values or it may store 5
values.
Now my req. is that I need to as
On Aug 15, 2007, at 7:04 PM, Xavier Noria wrote:
perl -0777 -pi.bak -we 's{()(.*?)()}{$x = $2; $x =~
tr:-: :; "$1$x$3"}geis' *.html
A small improvement, groups are unnecessary because the elements are
guaranteed not to have hyphens (in general they could, for instan
On Aug 15, 2007, at 6:45 PM, Dennis G. Wicks wrote:
Greetings;
I have, conservatively, dozens of html files to change.
I can find them and pass the file name to perl and
do the usual s/// changes but there is one change I can't
figure out.
There is a line in each file that looks like
Th
On Aug 13, 2007, at 1:57 PM, Jeff Pang wrote:
Yes that's fine.
I think when we say 'use Apache qw/exit/' in modperl scripts,it may
do the same things as you mentioned -- modify the typeglob directly
-- but I'm not so sure.
I don't know too much XS but looks like this code in src/modules/pe
On Aug 13, 2007, at 9:29 AM, Jeff Pang wrote:
Does die call exit when it's excuted?
If so,when I overwrote exit() function in my script,would die call
this customized
exit?
Do you want some code executed if the program dies? If that's the
case assign a coderef to $SIG{__DIE__}:
$SIG{_
El Aug 3, 2007, a las 1:45 PM, Mr. Shawn H. Corey escribió:
But the expression $hash{"@cdr[2,3,6,7]"} is the same as $hash{join
($",@cdr[2,3,6,7])} You have just replaced one special variable
with another and $" is a bad choice since it's default is a space
character, which may easily appea
El Jul 19, 2007, a las 12:19 AM, Joseph L. Casale escribió:
Interesting,
I see from your regexp you use a \A and \z, from Perldoc this means:
\A Match only at beginning of string
\z Match only at end of string
I am not sure I understand this requirement?
^ and $ depend on flags, and
El Jul 18, 2007, a las 11:19 PM, Joseph L. Casale escribió:
How can I detect this, I have been running some code for a few days
to develop some files and ran into the situation where I am getting
the following data for input:
14.95313 14.45312 0
14.95313 1.570813E-015 0
14.95313 -14.45313
On Jul 2, 2007, at 2:46 PM, Gabriel Striewe wrote:
Dear List,
I wanted to interpolate a function reference in a here doc.
The following works fine:
my $hello = sub {
return "hello world!";
};
printf "hello $s\n", &$hello();
In Perl printf is rarely used beca
On Jun 22, 2007, at 11:57 AM, Ben Edwards wrote:
I am opening a log file:
open( LOGFILE, ">>cronlog.txt" );
This is being written to in lots of places.
I have been asked to change the program so if -m (manual) flag is
passed the stuff that goes to the log file is send to standard out
instead
On Jun 14, 2007, at 12:49 PM, Jorge Almeida wrote:
Martin was right (and I should have seen it from the start). The "will
go ahead as much as possible" is true only in the sense that the
greatest possible string of non-digits will be selected for deletion.
With '$s=~s/\D*//;' in line 5 that stri
On Jun 14, 2007, at 12:10 PM, Martin Barth wrote:
On Thu, 14 Jun 2007 11:04:51 +0100 (WEST)
Jorge Almeida <[EMAIL PROTECTED]> wrote:
I'm missing something about Perl's regexp:
1 #!/usr/bin/perl -w
2 use strict;
3 my $s=;
4 $s=~s/\D*//;
5 $s=~s/\D*//;
6 print "$s\n";
When in
On Jun 14, 2007, at 12:04 PM, Jorge Almeida wrote:
I'm missing something about Perl's regexp:
1 #!/usr/bin/perl -w
2 use strict;
3 my $s=;
4 $s=~s/\D*//;
5 $s=~s/\D*//;
6 print "$s\n";
When input is 'a123b', I get '123b', but I expected '123'.
s/\D+//g;
-- fxn
--
To unsubscr
On Jun 10, 2007, at 9:18 PM, On Ali wrote:
Is there a perl equivalent to PHP variables $_POST and $_GET?
Perl is a general-purpose programming language and does not have web
stuff builtin. To do web programming you need to pick some library/
framework like CGI.pm or Catalyst for example.
On Jun 8, 2007, at 9:52 PM, ash wrote:
I need to remove decimal points from numbers. For eg 1.23 or 1.77
would be just 1. Any suggestion is appreciated. Thank you.
Use de int() function.
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Jun 8, 2007, at 1:33 PM, Nath, Alok (STSD) wrote:
Hi,
What is the convention used to declare constants in perl ?
In C we declare constant type in Capital letters , not sure
how its in perl.
Same convention:
use constant FOO => 3;
-- fxn
--
To unsubscribe, e-m
On Jun 1, 2007, at 4:29 PM, Beginner wrote:
Hi,
I am trying to copy some file from a removable HDD to a network
drive. I want replicate the directory structure and omit un-needed
files.
The directory paths a 4-5 levels deep and I am trying to work out an
efficient way to recreate the directory
On May 15, 2007, at 6:49 PM, Xavier Noria wrote:
To prevent this there's quotemeta(), which is available in literals
as \E:
Oh sorry, I meant \Q there.
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On May 15, 2007, at 6:42 PM, Mike Blezien wrote:
Hello,
this one has been driving me nuts and I'm sure it's something very
simple I maybe overlooking. I need to assign a delimiter variable
IE: Pipe or Comma delimiter:
my $del = '|'; # use either a '|' or ','
my $dataline = "0|1|2
On May 14, 2007, at 3:50 PM, Robert Hicks wrote:
I am working on a Perl 5.6.0 project and went to use "cpan" at the
command line and behold it was not there. I download the 5.6.1 tar
file and behold "cpan" the command line program wasn't in there
either.
Did it not come with 5.6.0/5.6.1?
On May 14, 2007, at 3:52 PM, Tatiana Lloret Iglesias wrote:
Thank a lot!
Another related question,,, system command can be used also for linux?
Sure. Of course it is unlikely that the arguments themselvels are
portable in practice, I mean blastall won't probably be located at "d:
\\blast\\
On May 14, 2007, at 3:44 PM, Tatiana Lloret Iglesias wrote:
Hi all,
I have to execute this command from perl:
my $status = system("d:\\blast\\bin\\blastall -p blastn -i $file -d
$patDB
-o $workdir\\blast_$blast_file_id.txt");
but the problem is that $workdir contains spaces how can I
On May 4, 2007, at 2:44 PM, Nigel Peck wrote:
Within the script I want to know where it was executed from; CGI or
command line/cron job. I'm currently checking @ARGV to do this i.e.
if there is data in @ARGV then it was called from the command line,
but obviously this means there must be co
On Apr 26, 2007, at 2:34 AM, Nishi wrote:
What is the equivalent of basename? Ie if I dont want to use basename
package to get the filename off a path, what reg expr can i use in
perl?
File::Basename is a standard module, why you don't want to use it?
-- fxn
--
To unsubscribe, e-mail: [
On Apr 15, 2007, at 6:38 PM, Mário Gamito wrote:
I have this site that auto generates an index.html file every 15
minutes
(it's a blog aggregator).
I need that every time the file is generated, all the contents between
the lines
href="http://domain.com/2006/08/bourne-shell.html";>Bourne Shell
On Apr 13, 2007, at 1:02 PM, Randal L. Schwartz wrote:
No, because the CPAN.pm shell is an installer, not a packager. It
does not
maintain a list of which files belong to which installations, and
will happily
let two installations both write to the same file. This will be
problematic
whe
On Feb 20, 2007, at 7:49 AM, Dharshana Eswaran wrote:
I need to use a C header file in Perl program in Unix.
Is it possible to use the header files from perl in any way? I do
not want
to use any modules for the same.
I do not want to enable the perl program to call a routine in C
library
On Feb 11, 2007, at 9:39 PM, [EMAIL PROTECTED] wrote:
Well, here's my problem: I have found a way to wrap a text file down
to a narrower column width. But it looses paragraph formatting.
What I need
is the same thing as converting a file from DOS (line break after each
line) to Windows (line
On Feb 11, 2007, at 1:36 AM, [EMAIL PROTECTED] wrote:
I wonder if there is a format that preserves paragraph breaks while it
kills line breaks?
How do you define a paragraph break. Why does the subject mentions
DOS to Windows.
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For add
On Jan 23, 2007, at 9:55 AM, Dr.Ruud wrote:
Use an anchor and a negated character set:
s/\.[^.]*$//
That solution is broken, think "/foo/bar.baz/woo". Correct regexps
and other approaches have already been posted.
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional comm
On Jan 23, 2007, at 8:22 AM, Saravana Kumar wrote:
Hi list,
I am trying to remove the extension from the a list of filenames and
manipulate the names further.
Tried to doing this:
$file=~ s/\..*//;
The above works fine. I get the result 'filename' if the filename is
filename.ext.
There are s
On Jan 19, 2007, at 12:55 PM, Richard Jones wrote:
while ( my $ref = $sth->fetchrow_arrayref() ) { # $ref is arrayref
push @$ref, 1; # line xx
}
dies with 'Modification of read-only value attempted at .. line xx'
I can't see the difference here between the two $ref arrayrefs, but
Perl obvi
On Jan 19, 2007, at 5:53 PM, Bertrand Baesjou wrote:
Thank you very much, this is indeed the solution.
The explanation is that when you process lines this way
foreach my $line () { ... }
the readline operator is evaluated in list context and, thus, the
file is slurped into a single list
Xavier, this is being inefficient.
If you don't send a minimal example together with data example that
reproduces the issue this is a come and go of second-guesses, which
is a waste of time. Please send them so we can go straight to
understand what happens.
-- fxn
--
To unsubscribe, e-m
On Jan 13, 2007, at 7:43 PM, xavier mas wrote:
Here's an example:
in (file, array and hash) contains: "woman, lion, ball"
img (file, array and hash) contains: "ball, dog, cat, lion".
dict (file, array and hash) contains: "house, man, woman, kid,
kitchen, lion"
Comparing in with dict ans img
On Jan 13, 2007, at 6:29 PM, xavier mas wrote:
hello list,
I am trying to find if an element in one primary file (transformed
to array)
is included in two other different secondary files (transformed to
arrays,
too); the result is going to be printed as 1 or 0:
According to the code that
This article explains how this works and has this and other tricks:
http://www.onlamp.com/pub/a/onlamp/2006/08/17/understanding-
newlines.html
-- fxn
PS: I am in fact the author but that is irrelevant.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PR
On Oct 21, 2006, at 9:52 AM, xavier mas wrote:
Dear all,
Hi Xavier!
I'm trying to rename a bunch of files to the estination names
included in a
prepared files calling the system function "mv" inside a while loop
(that
reads the destination files one by one).
But when doing this, I get a
On Oct 20, 2006, at 11:54 AM, Chris Share wrote:
In the output of the following code there's a carriage return
between the $name variable and the "!". Where is this coming from?
Doesn't the chomp get rid of this?
#!/usr/local/bin/perl
$| = 1;
use strict;
use warnings;
use CGI qw(:standar
On Sep 9, 2006, at 9:48 PM, Randal L. Schwartz wrote:
"Xavier" == Xavier Noria <[EMAIL PROTECTED]> writes:
Xavier> On Sep 9, 2006, at 9:00 PM, chen li wrote:
I want to calculate the mean of an array. I know how
to let the job done by using a loop. But I just wonder
if Per
On Sep 9, 2006, at 9:00 PM, chen li wrote:
I want to calculate the mean of an array. I know how
to let the job done by using a loop. But I just wonder
if Perl has the short-cut/built-in function for this.
There are modules, but nothing builtin.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
F
On Aug 23, 2006, at 7:52 AM, anand kumar wrote:
Can anyone please explain how to connect to oracle database
server using perl script which is in separate linux server. Please
note that currently I am using putty to connect to linux server for
perl scripting and we have the Oracle database
On Aug 22, 2006, at 5:36 PM, chen li wrote:
Just a quick question: what is the line code for an
empty line using regular expression in Perl?
Empty lines match /^$/, blank lines do not match /\S/.
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL P
On Aug 21, 2006, at 8:51 PM, Mazhar wrote:
use strict;
use warnings;
my $file_name=$ARGV[0];
open(FILE,"$file_name") || die "Not been Accessed" ;
No quotes needed around $file_name there.
@host_array=;
That variable was not declared before, so that script does not run
because it does not
On Aug 16, 2006, at 2:54 PM, Xavier Noria wrote:
On Aug 16, 2006, at 2:33 PM, Krishnakumar K P wrote:
Hi,
There is a problem in coding perl in windows and using it in linux.
When you code in windows the file will contain dos/windows new
line pairs
instead of the Linux/UNIX single New Line
On Aug 16, 2006, at 2:33 PM, Krishnakumar K P wrote:
Hi,
There is a problem in coding perl in windows and using it in linux.
When you code in windows the file will contain dos/windows new line
pairs
instead of the Linux/UNIX single New Line character which may cause
error in
linux server.
On Aug 15, 2006, at 6:19 PM, SFantar wrote:
I know the grep function.
Normally, grep needs a pattern to match with values found in @array.
All the values found are returned in an array.
Is that right?
Not quite.
The elements of the array are passed to grep's block, one at a time,
and the bl
On Aug 15, 2006, at 5:49 PM, SFantar wrote:
On the contrary, the code written above is not clear yet. What does
your code do exactly when it comes
to deal with smith, edward which appear twice in @array initially?
What's what you don't understand, do you know grep?
-- fxn
--
To unsubscr
On Aug 15, 2006, at 3:42 PM, Xavier Noria wrote:
%seen = ();
@uniq = grep {
my $is_new = 0;
if not exists $seen{$_} {
Oh sorry I wrote that off the top of my head and forgot the parens.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
On Aug 15, 2006, at 2:28 PM, SFantar wrote:
Thank for your quick reply.
Your solution should suit me.
Can you give me more details/ explanations about your code?
What does your code do exactly?
Sure, we are using a hash table as a way to deal with duplicates,
which is a standard idiom in Per
On Aug 15, 2006, at 2:02 PM, SFantar wrote:
Hello everyone
I would like to sort an array so that it does not contain any
values twice or three times.
Unfortunately, perldoc -q sort does not help me very much.
Here is an example of this array :
@array = ('smith ', 'john ', 'edward ', 'smith
On Jul 28, 2006, at 9:50 PM, Joshua Colson wrote:
On Fri, 2006-07-28 at 21:28 +0200, Dr.Ruud wrote:
Robert Citek schreef:
Try a different value for the INPUT_RECORD_SEPARATOR ($/):
$/ = "\n" ;
(spaces added for clarity)
Is that different from the default?
(see perlvar)
Using ActiveState
On Jul 26, 2006, at 21:59, Steve Pittman wrote:
I am using activestate on a windows box ...the files I am parsing are
Unix files...I tried this so far...
open ( IN, "<$_[0]" )||die "Can't open DAT source file: $tempFile
$!\n";
while (){s/\r/\n/g;@lines = ;}#
close (IN);
On Jul 19, 2006, at 13:59, Ankam, Ramesh Babu wrote:
Can any one please tell me what this pattern means " s|.*/|| ".
Assuming there are no newlines in the string, that s/// means remove
everything up to, and including, the last slash. It's a typical
regexp for getting the basename of
On Jul 19, 2006, at 10:05, Sayed, Irfan ((Irfan)) wrote:
I think criteria shud be _ but I need output in following manner
That criteria is ambiguous becasue there are several _s and you need
to deal with them differently, that is, ignoring some and splitting
on some. Can you be more specif
On Jul 19, 2006, at 9:57, Sayed, Irfan ((Irfan)) wrote:
I need to split following string
cs_backup_restore_cmvobsvr1mum
the output which i am looking for is
cs_backup_restore and _cmvobsvr1mum
Which is the criteria, everything up to the last underscore?
-- fxn
--
To unsubscribe, e-mail
On Jul 6, 2006, at 10:41, Roman Daszczyszak wrote:
Does anyone have a suggestion for how I can handle this, or even where
I can look to solve this issue? Is there another possibility for
where the error is occurring that I am not seeing?
I would create the filehandle specifying the character
On Jul 6, 2006, at 6:26, Geetha Weerasooriya wrote:
Dear all,
When I was reading a Perl code I found the following line. Can u
please
explain what it means?
!defined($rt_nearest) or $dh<$dist or next;
It means
next unless !defined($rt_nearest) or $dh < $dist;
or, equivalently,
next
On Jun 19, 2006, at 22:45, Anthony Ettinger wrote:
# order matters
$raw_text =~ s/\015\012/\n/g;
$raw_text =~ s/\012/\n/g unless "\n" eq "\012";
$raw_text =~ s/\015/\n/g unless "\n" eq "\015";
Does it make any difference if I use s/\cM\cJ/cJ/ vs. s/\015\012/\n/
g ?
The regexp i
On Jun 13, 2006, at 20:26, Anthony Ettinger wrote:
I have to write a simple function which strips out the various
newlines on text files, and replaces them with the standard unix
newline \n
In Perl "\n" depends on the system, it is eq "\012" everywhere except
in MacOS pre-X, where it is "\01
On Jun 13, 2006, at 6:14, Vijay Kumar Adhikari wrote:
I understand. My question is that Net::Ping does not use that info at
all. If a host is alive, it will be listed in the output no matter
what port you specify. Is this a bug?
The module uses the port in several subroutines, like this
$sa
On Jun 11, 2006, at 14:20, Vijay Kumar Adhikari wrote:
This is from http://perldoc.perl.org/Net/Ping.html
# Like tcp protocol, but with many hosts
$p = Net::Ping->new("syn");
$p->{port_num} = getservbyname("http", "tcp");
foreach $host (@host_array) {
$p->ping($host);
}
w
On Jun 11, 2006, at 11:16, OROSZI Balázs wrote:
Chad Perrin wrote:
On Sat, Jun 10, 2006 at 10:53:30PM +0200, OROSZI Balázs wrote:
Makefiles are for installing modules, not for using them. If you use
the CPAN module management that is provided with common Perl
distributions, you shouldn't have
On Jun 6, 2006, at 14:16, John W. Krahn wrote:
Mr. Shawn H. Corey wrote:
$output_file =~ s/\r//g;
# chomp only removes linefeed characters \n
# BTW, there is no such thing as a newline;
# it is either a linefeed: \n ASCII LF 0x0A
# or a carriage return: \r ASCII CR 0x0D
"\n" is inherited fr
On Jun 6, 2006, at 12:59, joseph wrote:
All,
Just like to ask for correction on what's wrong with my script it
gives spit
out this error when i run it.
Unsuccessful open on filename containing newline at disksize.pl
line 8.
Can't open file No such file or directory
But it runs without th
On May 29, 2006, at 18:19, Ken Foskey wrote:
I want to monitor a daemon's logs that updates randomly through the
day
and night. Is there a way to open the log file and read the new
records
as they come in the same way as tail -f does?
Sure, with File::Tail for example.
-- fxn
--
To un
On May 24, 2006, at 18:48, Gavin Bowlby wrote:
I can suppress all warning checks by doing a:
no warnings;
if ($a == 7) {
use warnings;
but I would like all other "normal" Perl warnings to be used for the
statement:
if ($a == 7)
other than the check for the LHS of the equality check being a
On May 22, 2006, at 4:44, Wijaya Edward wrote:
Is there a way to do it? Module for it? Suppose I have this large
string.
my $string = 'foo bar
qux woo
etc etc';
I would like to convert that string as if it is stored inside a
file, and bypassing the file creat
On Apr 21, 2006, at 16:10, Bowen, Bruce wrote:
In perldoc under this topic s is listed as "Treat string as a
single line" and m as Treat string as multiples lines".
If I have text that has varying spaces at the begging of each line,
and I use
$string =~ s/^\s+//; It will remove the space
On Apr 21, 2006, at 20:59, Praveena Vittal wrote:
Is there any way to print a particular bit of a digit after
converting to binary form.
That can be easily done with substr y sprintf, this would take the
second bit of 7 written in base 2:
% perl -wle 'print substr sprintf("%b", 7), -2,
On Apr 19, 2006, at 9:13, Murphy, Ged (Bolton) wrote:
Hi all.
I have a log containing strings as follows :
21259 auditO 72398 Mar 09 00:18 dll/ldr/elf.c
The format is the same throughout with the exception of the 'O', as it
doesn't always appear.
I need to match when the 'O' appears
On Apr 17, 2006, at 10:30, Irfan J Sayed wrote:
Hi,
I have a following line stored in one variable $test.
deliver.Admin_Irfan_Project.20060413.212355 . I need to split this
line
into the words and store the output in array.
words should like this.
deliver
admin
irfan
project
20060413
21235
1 - 100 of 265 matches
Mail list logo