Re: a perl question

2011-01-04 Thread Chris Davies
S Mathias wrote: > cat asdf.txt > bla-bla > bla-bla > bla[XYZ] > importantthing > another important thing > [/XYZ] > bla-bla > bla-bla > [XYZ] > yet another thing > hello! > [/XYZ] > bla-bla > etc. > $ SOMEPERLMAGIC asdf.txt > output.txt > $ cat output.txt > importantthing > another important thin

Re: a perl question

2011-01-04 Thread Javier Barroso
On Tue, Jan 4, 2011 at 11:40 AM, Joao Ferreira gmail wrote: > On Tue, 2011-01-04 at 02:27 -0800, S Mathias wrote: >> cat asdf.txt >> bla-bla >> bla-bla >> bla[XYZ] >> importantthing >> another important thing >> [/XYZ] >> bla-bla >> bla-bla >> [XYZ] >> yet another thing >> hello! >> [/XYZ] >> bla-

Re: a perl question

2011-01-04 Thread Joao Ferreira gmail
On Tue, 2011-01-04 at 02:27 -0800, S Mathias wrote: > cat asdf.txt > bla-bla > bla-bla > bla[XYZ] > importantthing > another important thing > [/XYZ] > bla-bla > bla-bla > [XYZ] > yet another thing > hello! > [/XYZ] > bla-bla > etc. > $ SOMEPERLMAGIC asdf.txt > output.txt > $ cat output.txt > impor

a perl question

2011-01-04 Thread S Mathias
cat asdf.txt bla-bla bla-bla bla[XYZ] importantthing another important thing [/XYZ] bla-bla bla-bla [XYZ] yet another thing hello! [/XYZ] bla-bla etc. $ SOMEPERLMAGIC asdf.txt > output.txt $ cat output.txt importantthing another important thing yet another thing hello! how can i sovle this questi

Re: tricky perl question - ascending order

2010-05-23 Thread Jozsi Vadkan
The solution [from the FreeBSD mailing list]: perl -00 -e 'print map $_->[0], sort { $a->[1] <=> $b->[1] } map [$_, tr/\n//], <>' < before.txt > after.txt Thank you!! > or maybe in bash.. > script/"one liner" e.g.: input: http://pastebin.com/raw.php?i=pMZPEsMZ > > i want to make this output fro

Re: tricky perl question - ascending order

2010-05-23 Thread Jozsi Vadkan
wow, thanks!! and how exactly can i use this magic? http://pastebin.com/raw.php?i=XZ1rn2bM sorry for the dumb question:\ Thank you! > Jozsi Vadkan wrote: > > > or maybe in bash.. > > script/"one liner" e.g.: input: http://pastebin.com/raw.php?i=pMZPEsMZ > > > > i want to make this output fr

Re: tricky perl question - ascending order

2010-05-23 Thread Chris Jackson
Jozsi Vadkan wrote: or maybe in bash.. script/"one liner" e.g.: input: http://pastebin.com/raw.php?i=pMZPEsMZ i want to make this output from it: http://pastebin.com/raw.php?i=kH8VxT0A So from the input, i want to make an ascendant order, how many things are under a "SOMETHING-XX" Does anyon

tricky perl question - ascending order

2010-05-23 Thread Jozsi Vadkan
or maybe in bash.. script/"one liner" e.g.: input: http://pastebin.com/raw.php?i=pMZPEsMZ i want to make this output from it: http://pastebin.com/raw.php?i=kH8VxT0A So from the input, i want to make an ascendant order, how many things are under a "SOMETHING-XX" Does anyone has any "perl magic"

Re: perl question

2009-12-19 Thread Alex Samad
On Sat, Dec 19, 2009 at 11:00:07AM -0500, Chris Dale wrote: > On Sat, 19 Dec 2009, Alex Samad wrote: > > I have a set of constants setup in my script > > > > RC_OK > > ... > > ... > > > > I use LWP::Simple which also uses RC_OK, and I get a main::RC_OK > > redifinition > > > > is there some wa

Re: perl question

2009-12-19 Thread Chris Dale
On Sat, 19 Dec 2009, Alex Samad wrote: > I have a set of constants setup in my script > > RC_OK > ... > ... > > I use LWP::Simple which also uses RC_OK, and I get a main::RC_OK > redifinition > > is there some way around this with out renaming my constants. You can suppress symbol importing,

Re: perl question

2009-12-19 Thread Niu Kun
How about setting it a "local" variable? And I think that you'd better send such a question to a perl mailing list. Alex Samad wrote: > Hi > > I have a set of constants setup in my script > > RC_OK > ... > ... > > I use LWP::Simple which also uses RC_OK, and I get a main::RC_OK > redifinition >

Re: perl question

2009-12-19 Thread Gabor Urban
Hi, did you check this issue on Perl sites? Try to start with www.cpan.org. BTW this is a very great site. Good luck, Gabor 2009/12/19 Alex Samad : > Hi > > I have a set of constants setup in my script > > RC_OK > ... > ... > > I use LWP::Simple  which also uses RC_OK, and I get a main::RC_OK >

perl question

2009-12-19 Thread Alex Samad
Hi I have a set of constants setup in my script RC_OK ... ... I use LWP::Simple which also uses RC_OK, and I get a main::RC_OK redifinition is there some way around this with out renaming my constants. Alex signature.asc Description: Digital signature

Re: Stumped with a Posix/Perl Question

2004-04-01 Thread Ken Irving
On Thu, Apr 01, 2004 at 02:10:46PM -0800, William Ballard wrote: > Given: > > A - 1 > A - 2 > B - 1 > B - 2 > > what's the simplest command or perl script to print it as: > > A (1, 2) > B (1, 2) > > or something equivalent. Hmm, one of the zillions of ways of doing something equivalent, with t

Re: Stumped with a Posix/Perl Question

2004-04-01 Thread Thorsten Haude
Moin, * William Ballard wrote (2004-04-02 00:10): >Given: > >A - 1 >A - 2 >B - 1 >B - 2 > >what's the simplest command or perl script to print it as: > >A (1, 2) >B (1, 2) > >or something equivalent. Is that an array? Depending on the size and whether it's fixed I would use either printf or somet

Stumped with a Posix/Perl Question

2004-04-01 Thread William Ballard
Given: A - 1 A - 2 B - 1 B - 2 what's the simplest command or perl script to print it as: A (1, 2) B (1, 2) or something equivalent. Thanks -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Re: perl question

2001-07-25 Thread Ilya Martynov
>> Do not reinvent wheel :). Use standart Perl modules. >> >> use File::Path; >> rmtree([$dir]); >> >> See File::Path docs for more info. >> KGM> Correct me if I'm wrong, but this is what the OP *didn't* want to do KGM> (taken from File::Path doc): KGM> "All of the files and directories KGM

Re: perl question

2001-07-23 Thread Keith G. Murphy
Ilya Martynov wrote: > > >> > Here's one for some of the perl guys > >> > > >> > I want to delete a directory that will have files in it... > >> > I don't know the name of the files there for wildcards might > >> > be needed > >> > > >> > I understand that "rmdir" will wipe out an empt

Re: perl question

2001-07-23 Thread Ilya Martynov
>> > Here's one for some of the perl guys >> > >> > I want to delete a directory that will have files in it... >> > I don't know the name of the files there for wildcards might >> > be needed >> > >> > I understand that "rmdir" will wipe out an empty directory >> > and "unlink" wil

Re: perl question

2001-07-19 Thread will trillich
> >From: "Mike Egglestone"<[EMAIL PROTECTED]> > >To: "debian-user" > >Subject: perl question > >Date: Thu, Jul 18, 2002, 4:53 AM > > > > > Hello... > > > > Here's one for some of the perl guys > > > &g

Re: Perl Question Recap

2001-07-18 Thread Hamma Scott
--- Mike Egglestone <[EMAIL PROTECTED]> wrote: > thanks for all the inputs !!! Just condensing all the answers given (more for myself) >I'm really new to Perl and I'm guessing that >I can't run shell commands within a perl script... Check out system() and exec()...

Re: Perl Question Recap

2001-07-18 Thread Mike Egglestone
thanks for all the inputs !!! I ended up using the rmtree command... I needed to execute this in Perl because I have a web based emailer written in Perl... One part of the program will create an upload directory for the user ... however... I couldn't get a quota on it so I just delete the

Re: perl question

2001-07-18 Thread Rob Ransbottom
On Tue, 17 Jul 2001, Craig Dickson wrote: > > What would be a nice command to remove a dirtory that had files in it? > rm -rf directory But if you don't want to spawn a sh. Check all this as it is off the cuff and I would usually use backticks or system to do this type of thing. #!/usr/bin/per

Perl Question Recap

2001-07-18 Thread Hamma Scott
Mike's Question: I want to delete a directory that will have files in it...I don't know the name of the files there for wildcards might be needed I understand that "rmdir" will wipe out an empty directoryand "unlink" will wipe out files (only if I know the names of the files) Wha

Re: perl question

2001-07-17 Thread Calvin Chong
Simply Speaking, This would have been done better with these shell commands: # cd /directory # rm -rf * # cd ..; :) rgrds, Calvin "Lamer" -- >From: "Mike Egglestone"<[EMAIL PROTECTED]> >To: "debian-user" >Subject: perl question >Date: Thu

Re: perl question

2001-07-17 Thread Joost Kooij
On Wed, Jul 17, 2002 at 04:53:50PM -0400, Mike Egglestone wrote: > What would be a nice command to remove a dirtory that had files in it? > Even better what would be a nice command to delete all files > in one directory... (leaving the directory intact) #!/usr/bin/perl -w use File::Path; rmtre

Re: perl question

2001-07-17 Thread Bud Rogers
On Wednesday 17 July 2002 03:53 pm, Mike Egglestone wrote: > Hello... > > Here's one for some of the perl guys > > I want to delete a directory that will have files in it... > I don't know the name of the files there for wildcards might > be needed > > I understand that "rmdir" will wip

Re: perl question

2001-07-17 Thread Craig Dickson
Mike Egglestone wrote: > What would be a nice command to remove a dirtory that had files in it? rm -rf directory > Even better what would be a nice command to delete all files > in one directory... (leaving the directory intact) rm -rf directory/* which will delete everything in a director

perl question

2001-07-17 Thread Mike Egglestone
Hello... Here's one for some of the perl guys I want to delete a directory that will have files in it... I don't know the name of the files there for wildcards might be needed I understand that "rmdir" will wipe out an empty directory and "unlink" will wipe out files (only if I

ssl and libwww-perl question

2000-12-03 Thread Jonathan Lupa
libwww-perl supports ssl out of the box _kinda_ if Crypt::SSLeay is installed (or so the readme would have me believe). I dug around in dselect a bit and find only Net::SSLeay (which the doc says is better, but not compatible). The question is if anyone out there knows how to set debian packages u

Re: another perl question

2000-03-30 Thread Colin Watson
david sowerby <[EMAIL PROTECTED]> wrote: >Hi, can anyone tell me why there are perl5 binaries and perl-5 binaries in >/usr/bin ? Whats the differemce ? None: they're hard links to each other, provided for convenience. [EMAIL PROTECTED] ~]$ ls -i1 /usr/bin/perl{-5.005,5*} 2275 /usr/bin/perl-5.0

another perl question

2000-03-30 Thread david sowerby
Hi, can anyone tell me why there are perl5 binaries and perl-5 binaries in /usr/bin ? Whats the differemce ? -david -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Remember, you are unique ... just like everyone else. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Re: (hopefully) simple perl question...

2000-02-29 Thread Keith G. Murphy
Jonathan Lupa wrote: > > Is there a built in command, or shell command to retrieve the process > name from a pid? > > The best I could come up with is slurping the stuff from /proc/cmdline > or something like ps|cut, but it seems to me there is probably a > better way I am ignorant of. > I wonde

Re: (hopefully) simple perl question...

2000-02-29 Thread Jonathan Lupa
On Tue, Feb 29, 2000 at 03:42:20AM +, Colin Watson wrote: > [EMAIL PROTECTED] (William T Wilson) wrote: > >ps ax | awk '$1 == {print $5}' > > Or indeed 'ps -o%c h -p '. Thanks guys! :) -- [EMAIL PROTECTED] GPG public key available from http://www.jamdata.net/~jjlupa/gpg.asc pgp5px2HKSc

Re: (hopefully) simple perl question...

2000-02-29 Thread Colin Watson
[EMAIL PROTECTED] (William T Wilson) wrote: >On Mon, 28 Feb 2000, Jonathan Lupa wrote: >> Is there a built in command, or shell command to retrieve the process >> name from a pid? > >ps ax | awk '$1 == {print $5}' Or indeed 'ps -o%c h -p '. This will probably break on other Unices (and older vers

Re: (hopefully) simple perl question...

2000-02-29 Thread William T Wilson
On Mon, 28 Feb 2000, Jonathan Lupa wrote: > Is there a built in command, or shell command to retrieve the process > name from a pid? ps ax | awk '$1 == {print $5}' There's no builtin command to do this. I don't know if Perl can do it or not. I doubt it, though. > The best I could come up wit

(hopefully) simple perl question...

2000-02-29 Thread Jonathan Lupa
Is there a built in command, or shell command to retrieve the process name from a pid? The best I could come up with is slurping the stuff from /proc/cmdline or something like ps|cut, but it seems to me there is probably a better way I am ignorant of. Thanks! Jonathan -- [EMAIL PROTECTED] GPG p

Re: offtopic: perl question about dialog.pl

1999-10-26 Thread Eric G . Miller
What you'all don't count from zero? Okay, add one then... -- ++ | Eric G. Milleregm2@jps.net | | GnuPG public key: http://www.jps.net/egm2/gpg.asc | ++

Re: offtopic: perl question about dialog.pl

1999-10-25 Thread Mario Olimpio de Menezes
On Sun, 24 Oct 1999, Eric G . Miller wrote: > For a count of elements in an array > > $count = $#array; ^ this is the subscript of the last element in array, one less than the length, since there is a 0th element; $count++; # number of elements in array @array; you could als

Re: offtopic: perl question about dialog.pl

1999-10-25 Thread Eric G . Miller
For a count of elements in an array $count = $#array; -- ++ | Eric G. Milleregm2@jps.net | | GnuPG public key: http://www.jps.net/egm2/gpg.asc | ++

Re: offtopic: perl question about dialog.pl

1999-10-25 Thread Brad
-BEGIN PGP SIGNED MESSAGE- On Mon, 25 Oct 1999, Olaf Conradi wrote: > Use of implicit split to @_ is deprecated at ./dialog.pl line 34. > > $message_len = split(/^/, $message);# <-- line 34 split always splits to an array. Here, you're trying to get the number of elements ge

Re: offtopic: perl question about dialog.pl

1999-10-25 Thread Greg Wooledge
Olaf Conradi ([EMAIL PROTECTED]) wrote: > Use of implicit split to @_ is deprecated at ./dialog.pl line 34. > $message_len = split(/^/, $message);# <-- line 34 Split normally returns an array, not a scalar... unless I'm missing something. (I'm no perl guru.) -- Greg Wooledge

offtopic: perl question about dialog.pl

1999-10-24 Thread Olaf Conradi
Hello, I'm new to perl and want to write a small perl script with a nice userinterface. There is a wrapperscript for /usr/bin/dialog, but it gives the following warning: Use of implicit split to @_ is deprecated at ./dialog.pl line 34. I'm using potato with perl-5.005. What is the correct synta

Re: #!/Perl question

1999-09-17 Thread David Wright
Quoting Manoj Srivastava ([EMAIL PROTECTED]): > Hi, > >>"Joey" == Joey Hess <[EMAIL PROTECTED]> writes: > > >> The following works under more shells (and also is a man page ;-) > #!/usr/bin/perl -- # -*- Mode: Perl -*- # > 'di'; > 'ig00'; > > "true" || eval 'exec perl -S $0 $argv:q'; > eval

Re: #!/Perl question

1999-09-06 Thread Manoj Srivastava
Hi, >>"Joey" == Joey Hess <[EMAIL PROTECTED]> writes: >> The following works under more shells (and also is a man page ;-) #!/usr/bin/perl -- # -*- Mode: Perl -*- # 'di'; 'ig00'; "true" || eval 'exec perl -S $0 $argv:q'; eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec

Re: #!/Perl question

1999-09-03 Thread Joey Hess
Manoj Srivastava wrote: > Joey> eval 'exec perl -S $0 ${1+"$@"}' > Joey> if 0; > > The following works under more shells (and also is a man page ;-) > #!/usr/bin/perl -- # -*- Mode: Perl -*- # Yes, but it doesn't address the orginial problem: It will fail if perl is no

Re: #!/Perl question

1999-09-03 Thread Manoj Srivastava
Hi, >>"Joey" == Joey Hess <[EMAIL PROTECTED]> writes: Joey> eval 'exec perl -S $0 ${1+"$@"}' Joey> if 0; The following works under more shells (and also is a man page ;-) I used to use this as a template perl script with built in man page (this was before we had POD an

Re: #!/Perl question

1999-09-03 Thread d1temp
On 3 Sep, Hans van den Boogert wrote: > I'm trying to learn some Perl. I found an on-line book which is Unix > biased, but the scripts all start with #!/usr/local/bin/perl (which makes > sense if you have compiled and installed it yourself). However, on my > Debian system Perl was of course put i

Re: #!/Perl question

1999-09-03 Thread Richard Kettlewell
Brad writes: > One solution would be to write a makefile that detects the location > of the perl binary and then prepends the proper shebang line to the > beginning of your perl programs. Another trick is this: #! /usr/bin/env perl print "Hello, world\n"; This depends on env being in /u

Re: #!/Perl question

1999-09-03 Thread Colin Marquardt
* Hans van den Boogert <[EMAIL PROTECTED]> writes: > I'm trying to learn some Perl. I found an on-line book which is Unix > biased, but the scripts all start with #!/usr/local/bin/perl (which makes > sense if you have compiled and installed it yourself). However, on my > Debian system Perl was of

Re: #!/Perl question

1999-09-03 Thread Joey Hess
Hans van den Boogert wrote: > I'm trying to learn some Perl. I found an on-line book which is Unix > biased, but the scripts all start with #!/usr/local/bin/perl (which makes > sense if you have compiled and installed it yourself). However, on my > Debian system Perl was of course put in /usr/bin/p

Re: #!/Perl question

1999-09-03 Thread Brad
-BEGIN PGP SIGNED MESSAGE- On Thu, 2 Sep 1999, Brian Servis wrote: > *- On 2 Sep, Jonathan Markevich wrote about "Re: #!/Perl question" > > On Fri, Sep 03, 1999 at 03:04:49AM +0800, Hans van den Boogert wrote: > >> I'm trying to learn some Perl. I fo

Re: #!/Perl question

1999-09-02 Thread Brian Servis
*- On 2 Sep, Jonathan Markevich wrote about "Re: #!/Perl question" > On Fri, Sep 03, 1999 at 03:04:49AM +0800, Hans van den Boogert wrote: >> I'm trying to learn some Perl. I found an on-line book which is Unix >> biased, but the scripts all start with #!/usr/local/

Re: #!/Perl question

1999-09-02 Thread Jonathan Markevich
On Fri, Sep 03, 1999 at 03:04:49AM +0800, Hans van den Boogert wrote: > I'm trying to learn some Perl. I found an on-line book which is Unix > biased, but the scripts all start with #!/usr/local/bin/perl (which makes > sense if you have compiled and installed it yourself). However, on my > Debian s

#!/Perl question

1999-09-02 Thread Hans van den Boogert
I'm trying to learn some Perl. I found an on-line book which is Unix biased, but the scripts all start with #!/usr/local/bin/perl (which makes sense if you have compiled and installed it yourself). However, on my Debian system Perl was of course put in /usr/bin/perl. So how can I write a Perl scrip

perl question

1999-04-13 Thread Shao Zhang
Hi, I want to use perl to display a list a directories in the tree format, so that I can display them on the web. What is the best way to do it. Later on, I want to make the users be able to click on these tree nodes and to be able to set the permission on each directory. Thanks for any he

RE: simple perl question

1998-07-18 Thread Jeff Schreiber
dave oswald <[EMAIL PROTECTED]> writes: > > Normally I would consult with my reference books but am not able to > get to them. Or you could just try it! :) >I thought maybe something like: > >$CurrentTime=exec`date "+%D %T"`; >print $CurrentTime; > % perl -e '$CurrentTime = `date "+%D

Re: simple perl question

1998-07-18 Thread aqy6633
> I thought maybe something like: > > $CurrentTime=exec`date "+%D %T"`; > print $CurrentTime; > $CurrentTime=localtime(time); Alex Y. -- _ _( )_ ( (o___ +---+ | _ 7 |Alexander Yukhimets| \(

simple perl question

1998-07-18 Thread dave oswald
In a perl script i need to load a variable ($CurrentTime) with the systems current time. Normally I would consult with my reference books but am not able to get to them. I find myself using them when I need to work in perl which is not very often... I'm looking for time_stamp something like "07/17/

Re: Did I answer this perl question correctly?

1998-04-02 Thread Manoj Srivastava
Hi, Yes, "require 'blah.pl';" is correct. You may also want to look at .pm files and the new "use blah;" directives. manoj use Module LIST use Module use Module VERSION LIST use VERSION Imports some semantics into the current package

Did I answer this perl question correctly?

1998-04-02 Thread Mark Phillips
Hi, Could someone please confirm whether the answer I gave below to a friend about perl is correct? Thanks, Mark. -- Forwarded message -- Date: Thu, 2 Apr 1998 10:49:30 +0930 (CST) From: Mark Phillips <[EMAIL PROTECTED]> To: Bill Moran <[EMAIL PROTECTED]> Subject: Perl Dear B

Re: [Off Topic] Dumb Perl Question...

1997-12-01 Thread Adam Shand
> perldoc perlsec is your friend! :) > > Bottom line is that globs are *always* tainted, as is anything that > relies on shell processing (csh being how globbing is done). Yep, I realise this, but what I didn't have is an alternative. There's lots of info on de-tainting user input, but basicall

RE: [Off Topic] Dumb Perl Question...

1997-12-01 Thread Adam Shand
> I don't "know" the answer to this question, but in your shoes I'd start by > re-writing the above as: That (with a couple typo's fixed :) does the trick beautifully! Thanks for the pointer, I figured there had to be a way to do it. Adam. Internet Alaska

Re: [Off Topic] Dumb Perl Question...

1997-12-01 Thread Stephen Zander
Adam Shand wrote: > How do I untaint the glob, or better yet access it so that it's not > tainted to start with (if that's possible)? The files I'm accessing are > safe as only root can write to them, but I'd like to do this the 'right > way'. > > I can't find anything relevant to this in the docs

[Off Topic] Dumb Perl Question...

1997-11-30 Thread Adam Shand
Howdy... Sorry for this stupid question but I'm hoping someone can shed some light, and I'm a 'Perl Beginner'... I'm writing a suid perl script which needs to search through a whole bunch of files in a directory and return some information. It all works fine except that the tainting doesn't li