RE: Script's command-line options under Windows

2006-02-02 Thread Bakken, Luke
Daniel Kasak wrote: > Timothy Johnson wrote: >> It sounds like there is a problem with your file association. >> >> Open HKEY_CLASSES_ROOT and go to Perl-->Shell-->Open-->Command. >> >> The (Default) entry should probably read: >> >> "C:\Perl\bin\perl.exe" "%1" %* >> > I'll check it out tomorro

RE: File Parsing

2006-01-24 Thread Bakken, Luke
William Black wrote: > Hello, > > I'm reading from a file. I'm trying to read in five lines at a time > where each line has a newline and then process the lines into > separare variables. For example, > > Input File > - > Stevens, > Craig A Triangle Family Care PA > 106-A Ridgeview D

RE: Equal length ID numbers

2005-12-15 Thread Bakken, Luke
Andrej Kastrin wrote: > Hi all, > > Suppose that we have numbers 1 to 1000 and we want all numbers be > equal lengh; e.g.: > 0001 > 0002 > 0003 > ... > .. > 1000 > > Any ideaa on how to fix this problem? > > Best, Andrej perldoc -f sprintf -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addit

RE: Windows XP Pro vs Windows 2000

2005-11-10 Thread Bakken, Luke
Walter A Poor Jr wrote: > We have been using perl (ActiveState 5.8.6) on Windows 2000 PCs for a > year > > or so. Recently the PC techs replaced W 2000 with Windows XP Pro on > one of my PCs. Most perl functionality still works, but one key > operation in our main program now fails. > > The pr

RE: Missing objects in Database

2005-10-05 Thread Bakken, Luke
Ryan Frantz wrote: > But that does not work. Then I saw that for non-SELECT statements > (which I assume an EXEC is not; I'm new to DBs), that it will return > "OEO" if nothing was affected. I think, though, that this refers more > to INSERT and its ilk. > > Should I set RaiseError to 1? > >

RE: sort with special order

2005-10-03 Thread Bakken, Luke
JupiterHost.Net wrote: >> On Oct 3, JupiterHost.Net said: >> >>> I have a list of strings that start with an uppercase B, Q, or Z >>> >>> I need to sort them so they are in order of Q, B , then Z >>> >>> Any ideas or input on how to efficiently do that with sort() or even >>> map() is most appre

RE: Date in perl

2005-09-29 Thread Bakken, Luke
Tom Allison wrote: > Gomez, Juan wrote: >> I have a problem need to work with date >> >> I have a input like these : 20050829 and I need to change it to >> something like this : Aug 29 2005 >> >> but it still eludes me how to do that >> >> can anyone help me please? >> > I was going to say "

RE: Splitting on =

2005-09-21 Thread Bakken, Luke
Tommy Nordgren wrote: > How do you split a string on the equality character? > Neither split (/=/,$myvar) > nor split ('=',$myvar) > appears to work > "Home is not where you are born, but where your heart finds peace" - > Tommy Nordgren, "The dying old crone" You are doing something incorrectly.

RE: module and a class?????

2005-09-15 Thread Bakken, Luke
Jabir Ahmed wrote: > hello > can anyone tell me the basic difference between a > module and a class in perl. > > i would be glad if you could give a brief example.; > > thanks > > jabir perldoc perlboot -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTE

RE: Please Help!!! Newbie Question

2005-09-01 Thread Bakken, Luke
Perl wrote: > Hi List, > > I have this script which actually returns the value of the filename > with extension but If the file name is something like > "c:\projects\text 009.txt" (having a space in filename which is > common in windows). > This script only returns "text" instead of returning ful

RE: Please Help!!! Newbie question

2005-08-31 Thread Bakken, Luke
Perl wrote: > I am new to perl so I need some help from the list with this script. > It takes a value from command line and then returns afters processing. > For example, If value is "c:\projects\test 2005.txt" the script will > returns it as "test" (actually omitts any space in the directory or >

RE: Win32::OLE question(s)

2005-08-31 Thread Bakken, Luke
Bakken, Luke wrote: > Tim wrote: >> Hello. >> >> The following code produces the output below. The first column should >> be a date. This happens whether the "valof" function is used or not. >> Anyone have any Variant tricks? >> >> Than

RE: Win32::OLE question(s)

2005-08-31 Thread Bakken, Luke
Tim wrote: > Hello. > > The following code produces the output below. The first column should > be a date. This happens whether the "valof" function is used or not. > Anyone have any Variant tricks? > > Thanks. > Tim Read up on the Range property and Cells property. http://msdn.microsoft.com/li

RE: Date in perl

2005-08-27 Thread Bakken, Luke
Hi all I have a problem need to work with date I have a input like these : 20050829 and I need to change it to something like this : Aug 29 2005 but it still eludes me how to do that can anyone help me please? --- I normally don't just give ou

RE: route STDOUT to file

2005-06-27 Thread Bakken, Luke
Manish Sapariya wrote: > I use screen as my tool to deal with unstable network connection. > Its command line version of vncviewer. > > Screen dameon allows me to reconnect the previously opened screen, > if I by mistake detache or exit the current shell, or network forces > my connection down. H

RE: Best practice when using data from external files

2005-06-14 Thread Bakken, Luke
>>> Just one thing though - I need to have DBD::SQLite installed on my >>> server and it's not on there, nor will it be (again, not my choice). >>> I'm still up a certain creek without a paddle *grin* >> >> Well, that one is between you and your admins, but Perl development >> is *significantly* e

RE: remove duplicate lines (OT)

2005-05-27 Thread Bakken, Luke
> $ cat marc21textfile | uniq > outputfile Where's Randal for a UUOC award? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Spreadsheet::ParseExcel - Out of memory error

2005-04-27 Thread Bakken, Luke
> my $oBook; > my $oWks; > foreach $hashEntry ( @LOGS ) > { > > my ( $localfile)= $hashEntry->{name}; > my ( $err_msg ) = ""; # error message > variable > > > my $cmd = ""; > > # > # Get row count of each fi

RE: Edit Windows PATH

2005-04-27 Thread Bakken, Luke
Chris Devers wrote: > On Fri, 1 Jan 1988, amr wrote: > >> Do we have Perl script that can edit & add to the Windows (XP, 2000) >> path.? > > Is there a reason that a simple system() command won't work here? > > my $status = system( "SET PATH=%PATH%;$new_path" ); > die "Couldn't set %PAT

RE: Send file to printer

2005-03-24 Thread Bakken, Luke
> > Another guess - maybe the problem is the whitespaces in the printer > > name. Try escaping them using backslashes: > > copy ($source_file, '//HP-EXCH/HP\ LaserJet\ 4100(IS)'); > > > > I would also try changing the single quotes to double quotes. > > > > Hope this helps, > > -- > > Offer Kaye

RE: Executing perl code on the command line

2005-03-11 Thread Bakken, Luke
> I am unable to execute a statement like -- perl -e '' -- > I always get this response: Can't find string terminator "'" > anywhere before > EOF at -e line 1. >From the command line, use " " to quote your code and qq() or q() as quotes inside your code: c:\>perl -e"print qq(Hello\n)" -- To

RE: setting program priority by PID

2005-03-03 Thread Bakken, Luke
> Hello, > > I'm on windows and I'd like to set program priority, if I know program > PID. It is possible ? Use Win32::Process: http://search.cpan.org/~jdb/libwin32-0.24/Process/Process.pm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Running an application from a perl service

2005-02-09 Thread Bakken, Luke
> I've written a Perl service which to help monitor an > application. On discovering an issue it is to bring up an > Internet explorer window with a link to a particular site. > Everything works perfectly, except that the Internet explorer > window is not visable! > The service starts Internet

RE: grabbing print output

2005-02-07 Thread Bakken, Luke
> open (PIPE, "|-", "convert -negate -modulate 200,0 -negate - > pbm:- | gocr -") or warn "$!\n"; > print PIPE $file; #file is image content > close PIPE; > > prints to STDOUT everything I need (it is one line, lets say "This is > test"). How I can grab this, so I have in > $var = "This is te

RE: hash slice/exists vs. grep benchmark weirdness...

2005-01-25 Thread Bakken, Luke
> > You have to stop spending so much time playing with all this bogus > > benchmarking :) > > It not bogus :) Its an example to find the best method for a project. > > If you prefer I'll ask the question I was trying to answer with the > benchmark: > > Assuming you have an array of 0-15 elemen

RE: perl script to binary executible

2005-01-24 Thread Bakken, Luke
> I would like to convert my perl script into a binary > executable before > deploying it on a client machine > > I checked on google and found "perlbin" at sourceforge.net but that > does not seem to work. It gives compilation error with handy.h file > which is the perl distribution file. >

RE: Counting occurences of a char in a line

2005-01-17 Thread Bakken, Luke
> Hi, > > I have the following code in a script I'm writing: > > foreach my $line () { > if ( 10 == ($line =~ s/,/,/g) ) { > print OUT $line; > } > } > > Is this poor style? It looks a bit ugly, but I can't figure out a > better way to do it. I'm sure there is :) > The script wil

RE: separating list alphabetically

2005-01-17 Thread Bakken, Luke
> I have some data that needs to be split up alphabetically into lists > that start with each letter of the alphabet. Sample data is like the > following with real URL data in place of URL1 and URL2. Only > the first > field is important for alphabetizing. If I do an array with > each lette

Copying a hash-of-hashes

2004-12-30 Thread Bakken, Luke
> Hello List, > To explain the problem I am having, I wrote a simple snipet > that doesn't do > anything meaningful other than illustrating the behaviour I > want to avoid: > > my %hoh = ( > 1 => { > a => 5, b => 5 > }, > > 2 => 5 >

RE: Can someone translate a small .PY to Perl?

2004-12-28 Thread Bakken, Luke
> > Or more commonly: > > > > while :; do > > ... > > done > > > > because the ":" command is true. > > It works for me. That's the way I'd seen it done when I was > learning bash. I > believe the while checks the return value, not the output of > the command.

RE: Need advanced help with tracking down warnings in eval'd functions

2004-12-09 Thread Bakken, Luke
> Perl already has a mechanism for splitting a large program in to > several smaller files. > > perldoc AutoLoader Or modules for that matter. When I first read the eval trickery my first thought was "WHY???". -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

RE: Should be a simple substitution?

2004-12-08 Thread Bakken, Luke
> > I think the ?: must be extraneous: > > That construct lets the regex engine know that it doesn't need to > worry about saving backreferences to the parenthesized group. It's on the right hand-side of the regex, however. Look at the output: C:\src\perl>perl -pe"s<{([^}]+)}><(?:@{[ ($a = $1) =

RE: Should be a simple substitution?

2004-12-08 Thread Bakken, Luke
> > $var =~ s<{([^}]+)}><(?:@{[ ($a = $1) =~ y/,/|/ && $a ]})>; > > > Does it not need the 'ge' at the end? > > I don't understand why you are creating an anonymous array > with a single > value, then dereferencing it... And what does the "?:" do? I think the ?: must be extraneous: C:\src

RE: Should be a simple substitution?

2004-12-08 Thread Bakken, Luke
> And is this method any faster or more efficient than this? > > $var =~ s/\{([^}]+)\}/$v = $1; $v =~ s!,!|!g; qq!($v)!/ge; Why not find out yourself? C:\src\perl>type rebench.plx use strict; use Benchmark qw/cmpthese/; sub luke { my $var = 'blargh{a,b,c}'; my $v; $var =

RE: Should be a simple substitution?

2004-12-06 Thread Bakken, Luke
> >> I can usually figure out regexes, and this one seems simple, but it > >> still eludes me-- > >> > >> I'm looking for a regex (or a couple of regexes) to do the > following: > >> > >> blahblah{ab,abcd}blah --> blahblah(ab|abcd)blah > >> blahblah{a,b,c}blah --> blahblah(a|b|c)blah >

RE: how the print the first 7 letter of file name

2004-10-22 Thread Bakken, Luke
> Subject: how the print the first 7 letter of file name > > Hi > > I have a problem > > I have > $FILENAME=C:\Developer\view_local\local_nt\FDAFDSAFDSASDFA\ASD FDAFSASDF\NewProcess_date_22-oct-2004.log > > How to get 'NewProcess only word > > kindly let me know > > Regards > Sreedhar Your

RE: executing 1 liners from cmd prompt

2004-10-20 Thread Bakken, Luke
> >You can't use "'" as delimiter on Windows. Try: > > > > perl -e "print \"test\n\"" > Or always use q() and qq() for one liners: perl -e"print qq(test\n)" -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: help - $line =~ tr/images\//..\/..\/images\//

2004-10-19 Thread Bakken, Luke
> >> > #!/usr/bin/perl > >> > ## set up for output to be sent to browser > >> > print "Content-type: text/html\n\n"; > >> > ## read in mp3store.html > >> > if (open (INFILE, "<../../mp3store.htm")) > >> > { > >> > foreach $line () > >> > { > >> > $line =~ tr/images\//..\/..\/images\// > >> > >>

RE: help - $line =~ tr/images\//..\/..\/images\//

2004-10-19 Thread Bakken, Luke
> > #!/usr/bin/perl > > ## set up for output to be sent to browser > > print "Content-type: text/html\n\n"; > > ## read in mp3store.html > > if (open (INFILE, "<../../mp3store.htm")) > > { > > foreach $line () > > { > > $line =~ tr/images\//..\/..\/images\// > > $line =~ s/images\//\.\.\/\.\.\

RE: help - $line =~ tr/images\//..\/..\/images\//

2004-10-19 Thread Bakken, Luke
> Hi all, > I wonder if someone can help me. What I want to do sounds so > simple but I > just cant crack it. > I am reading in an html page and i want to change 'images/' to > '../../images' but i am going round and round in circles. > my code so far is this: > > #!/usr/bin/perl > ## set up for

RE: How to reinvent grep with perl? (OT: Cygwin grep)

2004-10-10 Thread Bakken, Luke
> > Voila. That's most likely your problem - a mismatch between > line endings > > and Cygwin mount point type. > > And in case you hadn't seen them before... there are at least a few > sets of unix tools for dos/windows. Cygwin maybe the best known but > I've used Uwin myself for sometime and

RE: speed of grep{s///} vs ??? or am i asking the wrong question?

2004-10-05 Thread Bakken, Luke
> >opendir LS, $directory or die "Can't opendir $directory: $!"; > >my @dirs = grep { -d $_ } readdir LS; > >closedir LS; > >return @dirs; > > thank you this is much more readable code too me- but i found out that > you need a fully qualified path... Right, either that or chdir first before doing

RE: speed of grep{s///} vs ??? or am i asking the wrong question?

2004-10-04 Thread Bakken, Luke
> #!/usr/bin/perl > > > use strict; > use warnings; > > sub get_subdirectories{ > # retrieves list of directories from passed directory > # returns directory list as an array > > my $directory = shift; > open LS, "ls -l $directory|"; > local $/ = undef; >

RE: failure with: system("dir /b"); exec("dir /b"); `dir /b`

2004-09-17 Thread Bakken, Luke
> I'm using ActiveState v5.8.4 on Windows XP Home03. > > Here is the entire script... > print `dir /s`; > print "\n-\n"; > system('dir /b'); > print "\n-\n"; > exec("dir /w"); > print "\n-\n"; Since dir is a built-in, you should do this: use strict; print qx!cmd /c dir /s!; print "

RE: how to encrypt my perl script

2004-08-16 Thread Bakken, Luke
Put a copyright notice in it and have a good lawyer. To: [EMAIL PROTECTED] Subject: **POSSIBLE SPAM**::how to encrypt my perl script Hello: I would run a perl script in my website which is hosted

RE: how do I handle filenames that have parens?

2004-08-13 Thread Bakken, Luke
> The error message: > sh: -c: line 1: syntax error near unexpected token `(' > sh: -c: line 1: `/usr/atria/bin/cleartool describe \ > /very_long_path/lang/menu_chinese(taiwan)_taiwan.950.vim | \ > /bin/grep specified_label' > sh: -c: line 1: syntax error near unexpected token `(' > sh: -c: line 1

RE: howto 'cat file|grep "foo bar"|wc -l' in perl

2004-07-30 Thread Bakken, Luke
> > Hello, > > > > I just started using perl and want to rewrite a simple bash > > script i've been > > using in the past to perl. > > > > I want to cat file|grep "foo bar"|wc -l and tried it the > > following way which > > worked for foobar as one word and not as two words. > > > > --- > > #!

RE: howto 'cat file|grep "foo bar"|wc -l' in perl

2004-07-30 Thread Bakken, Luke
> Hello, > > I just started using perl and want to rewrite a simple bash > script i've been > using in the past to perl. > > I want to cat file|grep "foo bar"|wc -l and tried it the > following way which > worked for foobar as one word and not as two words. > > --- > #!/usr/bin/perl > $logfile

RE: use lib - not known at compile time

2004-07-29 Thread Bakken, Luke
> I'm trying to add my own module "DEGS::ldegs" to a Perl program. > However, this module will part of a distribution called "RGSE", > which could be installed on a different path on different peoples PCs. > However, it will always be in the directory "$ENV{RGSE}/lib". > > The problem is when I ru

RE: Dates are killing me..

2004-07-07 Thread Bakken, Luke
> Hi Guys, > > I'm having a real hard time trying to figure this out.. > > There are tons of modules on dates, etc, but I can't seem to > find one to do > what I need. > > I have one date, for example: 2004-07-07. > > I need to take that date, get Monday's date and Sunday's date > where 2004

RE: multiple inheritance

2004-07-06 Thread Bakken, Luke
> > If so, in my > > constructor, how do I explicitly call the parent constructor? > >package Bar; > >@ISA = qw/Foo/; > >sub new { >my $class = shift; >bless Foo->new(@_), $class; >} Wouldn't you want this instead? package Bar; @ISA = qw/Foo/; sub new {

Copyright Violation -> RE: unique array

2004-07-02 Thread Bakken, Luke
> On Fri, 2 Jul 2004 14:32:49 -0400 , Bob Showalter wrote > > perl.org wrote: > > > From http://iis1.cps.unizar.es/Oreilly/perl/cookbook/ch04_07.htm, > > > > Methinks that stuff is illegally posted copyrighted information. > > Several people responded individually with comments like > this. If

RE: Find closest value

2004-05-17 Thread Bakken, Luke
Bob Showalter wrote: > Mike Blezien wrote: >> Hello, >> >> is it possible, with perl, to find the closest numerical value to a >> set value. IE. a set value of 15 and I have five values, >> 208,258,56,123 >> >> is there a function too go through the five values array to find the >> closest to 15

RE: Finding the current IP of my laptop

2004-04-22 Thread Bakken, Luke
> I would like to use a perl module instead of grep'ing the result of > ifconfig. > > Do you have so guidelines to give me ? > > Thanks in advance. Getting the IP is pretty platform dependent. If you're on Windows you can use Win32::IPHelper, but since you mentioned ifconfig I'm assuming you're

RE: "perl -i..." reminder?

2004-03-19 Thread Bakken, Luke
> Hello... > I need to add some boilerplate text to the very top of about > 17,000 files. I can get to the files easily enough (File::Find), but > there's a special syntax to edit a file in place, and it's > not specified > in Programming Perl, and it's a tough search on Google and > Perl

RE: Writing output of a Shell command directly to a file

2004-03-17 Thread Bakken, Luke
> Luke, > > Nope, this was the exact thing we were trying to get away > from. Suppose I > don't have space to store that file on the host box. We're > doing it in > stages now and I really want to get away from that since it > increases disk > activity on the host box during a full backup. C

RE: Writing output of a Shell command directly to a file

2004-03-17 Thread Bakken, Luke
> @in = ssh("1.1.1.1", "tar cf - /home/$user | gzip") > open(TEMP, ">/tmp/$user.tar.gz") or die "Blargh!"; > print TEMP @in; > close(TEMP); Can you do this in stages? Create tar file: ssh("1.1.1.1", "tar cf - /home/$user | gzip -c | dd of=/tmp/foo.tgz") Use ftp or scp to get it to your backup ma

RE: Pattern matching problem

2004-02-25 Thread Bakken, Luke
> I'm having trouble counting the number of specific substrings > within a > string. I'm working on a bioinformatics coursework at the > moment, so my > string looks like this: > > $sequence = "caggaactttcggaagaccatgta"; > > I want to count the number of occurrences of each pair of > let

RE: using substr... is this efficient

2004-02-20 Thread Bakken, Luke
> -Original Message- > From: Larry Sandwick [mailto:[EMAIL PROTECTED] > > I have a scripted I wrote that uses *substr* on a file that has fixed > fields. I have to parse the file before I upload into MYSQL. > > Is there a more efficient way other than *substr*, I looked a > *pack* and >

RE: Why does this keep happening?

2004-02-17 Thread Bakken, Luke
> -Original Message- > Subject: Why does this keep happening? > > I'm running perl under windows XP and I keep geting this error: > > syntax error at (Directory and filename) Line 6, near " ) > {" > syntax error at (directory and filename) line 9 near "}" > > The source code is below, bu

RE: Is it a perl Bug?

2004-02-04 Thread Bakken, Luke
> Tom Franklyn <[EMAIL PROTECTED]> wrote:From: "Tom Franklyn" > Subject: Is it a perl Bug? > Date: Wed, 04 Feb 2004 12:43:56 +0200 > > Dear all, > > I've following code : > > == > #!/usr/bin/perl > > my $a = "ab:cd:ef"; > my @b = split(/:/,$a); > print ("@b\n"); > > my @c = ('/:/', $a

RE: WinNT perl scripts - adding modules on all machines

2004-01-28 Thread Bakken, Luke
> Just a question or doubt I had. Now using > activestate's activeperl if I deploy it on all > machines on my network. And I have certain scripts for > those machines. If I release a new script that depends > on a perl module not on the activeperl distribution by > default how can I distrub

RE: How to call perl programs from ASP page

2004-01-26 Thread Bakken, Luke
> This is what that gets me: > > Error Type: > PerlScript Error (0x80004005) > Global symbol "$Server" requires explicit package name > You have a syntax error in your perl program. Try running "perl -c" on it from the command line. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional c

RE: How to call perl programs from ASP page

2004-01-26 Thread Bakken, Luke
I've missed some of this thread - what is the output of c:\>assoc .pl (should say something like .pl=Perl) c:\>ftype Perl > -Original Message- > From: PerlDiscuss - Perl Newsgroups and mailing lists > [mailto:[EMAIL PROTECTED] > Sent: Monday, January 26, 2004 9:05 AM > To: [EMAIL PROTE

RE: Covert Date to week number

2004-01-22 Thread Bakken, Luke
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 22, 2004 11:28 AM > To: [EMAIL PROTECTED] > Subject: Covert Date to week number > > > Is their a way in PERL to covert a date to a week number > > > Cheers > > Neill Date::Calc has w

RE: Writing custom cookies using LWP::UserAgent

2004-01-20 Thread Bakken, Luke
> I am having LWP::UserAgent fetch information from a site that uses > Javascript to write a cookie like this: > > document.cookie = "jscript=1; path=/;"; > > Is there any way to tell my User Agent to add that cookie to > the cookie > jar? I had to do something similar, and rather than mess wit

RE: Why isn't perl used more in business and industry

2004-01-17 Thread Bakken, Luke
> Most of the scripts I see end in an extension like .jsp, > .asp, .dll, or > something which says that they aren't perl. Is there a reason more > businesses and online companies don't use perl? > > -Dan I would bet just about every major company uses Perl in one way or another. The financial c

RE: coping txt files over a peer to peer.

2004-01-07 Thread Bakken, Luke
> Howdy, > Funny I was just thinking about Sockets today. > I don't use them nitty gritty like this but I would assume > you need to do multiple send/receive/accept in a little > session via your own prtocol. > > Something like: > > Client> hello > Server> howdy > Client> NAME fred.txt > Serve

RE: ActiveState ActivePerl 5.8 - system call

2004-01-06 Thread Bakken, Luke
> $arg1="userid"; > $arg2="password"; > @args = ("C:\\perlcode\\validate.exe","$arg1","$arg2"); > system(@args); This system() call is most likely not using the shell. > $exit_value = $? >> 8; > $signal_num = $? & 127; > $dumped_core = $? & 128; > print "$exit_value, $signal_num, $dumped_core\n

RE: piped system commands

2003-12-30 Thread Bakken, Luke
> I want to run a command inside a script. From the shell, > here's the command: > > % ps -ef | /bin/egrep '/usr/lib/sendmail' | /bin/grep -v grep > | /bin/awk '{print $2}' > 19460 Instead of the useless 'grep -v grep', do this: % ps -ef | egrep '[/]usr/lib/sendmail' | awk '{print $2}' > But

RE: Pure Perl df

2003-12-30 Thread Bakken, Luke
> > That's your answer. Use $^O and other OS indicators and set up df's > > args > > appropriately then. > > Which gets us back to my other question: Is there a Windows > equivalent? Sure, look at the output of the 'dir' command. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

RE: Pure Perl df

2003-12-30 Thread Bakken, Luke
> >> I browsed the CPAN a bit, but wasn't too happy with the > >> choices there, > >> aside from the fact that any module installs would pretty > much defeat > >> the purpose here. > > > > Why is that? That is the point of modules. > > Well, as I said we're talking about 32 servers running at lea

RE: Pure Perl df

2003-12-30 Thread Bakken, Luke
> Okay, I'm at a loss and need help. A friend of mine is > working with a > Perl script. It has a system call to df in it, he would like to > replace with something a little more portable. Well, looking here at the source to df on OpenBSD: http://www.openbsd.org/cgi-bin/cvsweb/src/bin/df/df.c

RE: techniques for handling large text files

2003-12-29 Thread Bakken, Luke
> How's abouts this (pls excuse any syntax errs) . > > my $out1 = "$file1.txt"; > my $out2 = "$file2.txt"; > > open(INPUT, $filename) or die "error: $filename cannot be opened\n"; > open(OUT1, ">$out1") or die "error: $out1 cannot be opened > for writing\n"; > open(OUT2, ">$out2") or die "er

RE: advanced diff in Perl

2003-12-15 Thread Bakken, Luke
The Config::General module can read Apache-style config files. You should then be able to compare the contents of the files by comparing the hash tables returned by Config::General. Luke -Original Message- From: Dusan Juhas [mailto:[EMAIL PROTECTED] Sent: Mon

RE: Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-14 Thread Bakken, Luke
> uninitialized value in > pattern match (m//) at ./getopt.pl line 14.' Use the standard Getopt::Std module to process options. Don't do it yourself. > Line 14 is the while line.. > > I've tried all sorts of stuff with defined but keep getting syntax > errors. I've tried perldoc warnings and

RE: 64 bit Perl memory test...

2003-12-04 Thread Bakken, Luke
> Will this tell me how much memory is used at the point > of failure? See code. > > Unfortunately, there is no /dev/random in HP-UX. But there is a /dev/zero use strict; $|++; my $mem; my $bigbuf; my $buf; open IN, '/dev/zero' or die "Can't open random device: $!"; while( $mem += read(I

RE: Compile help...

2003-12-04 Thread Bakken, Luke
> I am trying to compile a 64bit Perl with Largefiles > support. I am > seeing the following error during the 'make test'. Any help > would be most > appreciated. This is version 5.6.1 on HP-UX 11i. The > compile is being > performed with the HP ANSI C compiler. > > lib/syslfs

RE: 64 bit Perl memory test...

2003-12-04 Thread Bakken, Luke
> how they were monitoring and/or determining this. Basically, > I would like > help with a Perl test script to use memory until Perl reaches > it's memory > limit. This will help me to know when I have things right so > I don't have > to keep going back to the end users and tell them "OK, try

RE: 64 bit Perl memory test...

2003-12-04 Thread Bakken, Luke
> It was Thursday, December 04, 2003 when Bakken, Luke took the > soap box, saying: > : > how they were monitoring and/or determining this. Basically, > : > I would like > : > help with a Perl test script to use memory until Perl reaches > : > it's memory

RE: Config file

2003-12-02 Thread Bakken, Luke
> What is the best way to read a config file for a perl script. I have > some very ugly code that can do it, but I would like to find > something > cleaner. I've used Config::General for several production projects and it works quite well. Luke -- To unsubscribe, e-mail: [EMAIL PROTECTED] Fo

RE: Encrypting PERL source code...

2003-12-01 Thread Bakken, Luke
> -Original Message- > From: [EMAIL PROTECTED] > > Can anyone suggest where I might be able to find (hopefully a freeware > or shareware script..) a program that runs either on a > windows system or > a PERL script that would "encrypt" a perl script by doing > such things as > removing

RE: Pointers

2003-11-20 Thread Bakken, Luke
> ok why the $$ instead of the %$? > > sorry confused. > > \%overData. Now how do > I access this hash. %$overData? Because you're in essence doing this: ${ $overdata }{$key} When you access a hash value, you're getting a scalar, which is why you use a $. Perhaps this notation would be c

RE: Help - In crunch Situation Print to file append Windows or Linux

2003-11-20 Thread Bakken, Luke
> Almost forgot this is plain text data. > > >http://www.cs.wisc.edu/~ghost/redmon/ > >Use redmon to set up a re-direct port. Redirect to a perl > program that > >opens a file for append and appends >the print data to it. If you're > opening the data in MS Word (I can't tell from your description

RE: Help - In crunch Situation Print to file append Windows or Linux

2003-11-20 Thread Bakken, Luke
> Ok I am in a crunch situation. I have to gather a report from > a credit card system. The system is archaic and runs on > windows. On this software I have to go in for each day since > January and print a report ( you can not do this as a batch > :( gr some programmer should be shot, twic

RE: win32 modules

2003-11-04 Thread Bakken, Luke
> The purpose of my script is to auto discover every system > on a network > Stack beginning using tcp/ip protocols and then later using > snmp also. > > The data I will be collecting is for the sole purpose of gather > information about a site and a site configuration. Similar to > tools

RE: using modules only when available

2003-10-27 Thread Bakken, Luke
> I would have thought in this case you would want the BLOCK form of > 'eval' rather than the EXPR form? Or does it matter? Gurus can you > expound on the differences in this case? > > Give: > > eval { use Tk }; > if ($@) { > # module not ok, etc. > } > > A try. perldoc -f eval > > http://d

RE: Can't Compile BerkeleyDB on OS X with Perl 5.8.1

2003-10-27 Thread Bakken, Luke
> -Original Message- > From: Aaron Davies [mailto:[EMAIL PROTECTED] > > I'm trying to install BerkeleyDB via CPAN on my OS X 10.2.6 box, but > the make phase bombs almost immediately. I've put the error log at > , since > it's a little

RE: cat zipped files

2003-10-27 Thread Bakken, Luke
> -Original Message- > I was hoping someone would have an idea of how to cat zipped > files.. gzcat > is NOT available to me, however, cat and zcat are.. But is > there a module or > sample perl script to cat zipped files? Thanks, Steve. If you have gzip, look at gzip -d -c -- To unsub

RE: How to delete a file from the file system

2003-10-23 Thread Bakken, Luke
H. Look at "perldoc -f unlink" > -Original Message- > > Hi, > > Is there any module which has methods that can be used to > delete a file from the filesystem in the > windows NT environment. > > Thanks in Advance > Chinku -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

RE: Aliases in Perl?

2003-10-20 Thread Bakken, Luke
> Hi, > > Are there 'aliases' in perl? For example, if I have a Korn > shell script and > a function named "increaseCost()", I can do this: "alias > decreaseCose=increaseCost" (passing a parameter in). of > course this is a > simplified example of what I want to do, but the point is to mak

RE: grep argument list too long...how to get around it?

2003-10-09 Thread Bakken, Luke
> > Dan> for(`ls /files/`) { > > Dan> if(`cat $_ |grep $string`) { push(@matchedfiles,$_); } > > Dan> } > > > > Hmm. Where to begin? > > > > - Dangerous use of ls. > > - Useless use of cat. > > - Dangerous use of backticks. > > - Shelling out when every one of those steps is done as well > > or

RE: grep argument list too long...how to get around it?

2003-10-09 Thread Bakken, Luke
> We use the Barracuda Spam appliance (barracudanetworks.com) to filter > our spam and their web based interface is written in Perl. > They have a > form that allows the user to search messages for key words. > Evidentally > it stores the each message in a file in a directory and when trying to

RE: initialising a list of variables

2003-10-03 Thread Bakken, Luke
> but if I use: > > [EMAIL PROTECTED] gary]$ cat t > #!/usr/bin/perl -w > > use strict; > > my ($fred,$ginger)=''; > > print "fred=$fred\n"; > print "ginger=$ginger\n"; > [EMAIL PROTECTED] gary]$ ./t > fred= > Use of uninitialized value in concatenation (.) or string at > ./t line 8. > ginger=

RE: grep with [ ] brackets ... ?

2003-09-23 Thread Bakken, Luke
> write a "filter" that executes code on each element and returns the > element (possibly modified) regardless of what the return value of the > filter would be, you can do: > > grep [ ... ], LIST > # or perhaps > grep [ do {...} ], LIST > # or > grep { ...; 1; } LIST > You guys must h

grep with [ ] brackets ... ?

2003-09-22 Thread Bakken, Luke
I'd thought I'd seen everything with perl until I saw John Krahn give this code as a solution: #syntax: unfold.pl filename > newfilename @ARGV or die "usage: $0 filename\n"; $/ = ''; print for grep [ chomp, s/\n\s+/ /g, s/\z/\n\n/ ], <>; I've never seen grep used with [ ] brackets before - it

RE: install modules in winXP

2003-09-10 Thread Bakken, Luke
> >Hello, > > > >When I try to install modules from CPAN to my Window XP > followed by perl > >Makefile.PL nmake nmake test nmake install > > > >Most time installation is OK, but sometime I get following > message after > > > >"nmake": > > > >'cl' is not recognized as an internal or external comm

RE: Learning Perl vs. c ++

2003-08-01 Thread Bakken, Luke
I hate to add to what is quickly degenerating thread, but as I develop C/C++ and perl professionally for one of the largest financial corporations in the world, I think I can add something to the discussion. > The point I was trying to make, is that Perl itself does not stimulate > readability,

RE: Calculating Disk Space and Freespace on Windows

2003-06-24 Thread Bakken, Luke
You want Win32::DriveInfo > -Original Message- > From: Denham Eva [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 24, 2003 12:42 AM > To: BeginnersPerl (E-mail); Perl-Beginner (E-mail) > Subject: Calculating Disk Space and Freespace on Windows > > > Hello, > > I'd appreciate any sugges

RE: Use of Perl for global changes

2003-06-24 Thread Bakken, Luke
cd /whatever dir perl -i.bak -pe's/\bmysql_pconnect\b/mysql_connect/g' * If everything is OK, delete the *.bak files. Luke > -Original Message- > From: Peter Goggin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 24, 2003 8:08 AM > To: [EMAIL PROTECTED] > Subject: Use of Perl for global

  1   2   >