Fwd: Using PerlPod creatively

2017-03-24 Thread Sami Joseph
Hi, I am interested to understand what this guy did, but i am unable to, can someone please break it down to a newbie I've spent the last several days at work, trying to "take over" some work left behind by a departing colleague. I realized we didn't have some of his bash scripting in ansible or

Variable Assignment

2011-08-16 Thread Joseph L. Casale
What is the correct way to quickly assign the result of a regex against a cmdline arg into a new variable: my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); Obviously that's incorrect but is there a quick way without intermediate assignment? Thanks! jlc -- To unsubscribe, e-mail:

RE: Variable Assignment

2011-08-16 Thread Joseph L. Casale
Yes, you can use: ( my $var = $ARGV[0] ) =~ s/(.*)foo/$1/i; Rob/Octavian, Thanks for the quick help! jlc -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

net::snmp and fetching extend data

2011-02-09 Thread Joseph L. Casale
I am trying to write a script that takes the extend name as an arg and retrieves the output for further processing. I am not sure how to do this, get_request() needs a numeric oid, is there a way around this or is get_request() not the best way to do this? Thanks for any help, jlc -- To

Adding cpan modules as non root in RHEL

2010-06-18 Thread Joseph L. Casale
I need a few modules not provided by Base or 3rd party rpm repos and since I don't want to mess up the rpm db, I am installing these cpan modules as non root into /opt/cpan by using 'makepl_arg' = q[PREFIX=/opt/cpan] The module I need is MIME::Tools which needs a newer File::Temp (0.16 versus

Here Docs

2010-04-30 Thread Joseph L. Casale
Inside a here doc, how can I force an expression to be evaluated such as localtime: print END; `localtime time` Foo Bar END I know I can simply create the var before, my $var = localtime time; But just curious how to evaluate expressions inside this... Thanks! jlc -- To unsubscribe,

Closing File Handles

2010-04-30 Thread Joseph L. Casale
Is it required to manually close a file handle I used to write debugging info to when the Perl scripts exits? Seems like a waste of effort at the end of the script to test `if debug...` and close the fh after? Thanks! jlc -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional

RE: Here Docs

2010-04-30 Thread Joseph L. Casale
You can use the trick mentioned in 'perldoc -q string' How do I expand function calls in a string? Funny that the perldoc uses the exact function I wanted to use:) localtime is a Perl function, not an external command, so: Thanks guys! jlc -- To unsubscribe, e-mail:

Feeding ouput from Net::Telnet into sub

2010-04-10 Thread Joseph L. Casale
I get a page full of output from a command passed into a Net::Telnet session that as per the cpan example is stored in $output. I then want to call a sub passing $output into it, that matches a string against each line, and sets a a var to OK if the match is successful. All is well, but I am

RE: Feeding ouput from Net::Telnet into sub

2010-04-10 Thread Joseph L. Casale
use a named variable with foreach loops. sure some docs and examples show using the default $_ but it can have problems with action at a distance. also a name makes the code read better. Ok, simple enough to do. and where does $match get set? it must be from outside the sub so it is a global.

RE: Feeding ouput from Net::Telnet into sub

2010-04-10 Thread Joseph L. Casale
nothing HAS to be global. you can pass it to a sub, you can store the options in a hash (my way and easy with getopt::long), etc. some globals may be useful but always using them or not know other ways is bad. Ok, fair enough. no. it is a single string with 4 lines in it. why would you think

RE: Feeding ouput from Net::Telnet into sub

2010-04-10 Thread Joseph L. Casale
so it could still likely use a review. especially if you are learning perl. many doc examples aren't written to the best coding standards. I'll take you up on that once its supposedly done:) Many great tips, thanks for all the help! jlc -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org

RE: Fifo Queue Job Scheduler

2010-04-08 Thread Joseph L. Casale
That depends on exactly what you are trying to do, how big of a job queue it should be, if there needs to be any feedback (like job status and error messages) and such. I for myself would go for a database backed system, as this implicitly avoids things like race conditions and file lock

Fifo Queue Job Scheduler

2010-04-07 Thread Joseph L. Casale
I have been pointed to a ksh script called qjob that implements a fifo queue. As none of our servers use or have ksh, this presents a bit of a problem as it also leverages a ksh implementation of a counting semaphore which would take ages to rewrite. I figure this is a job for Perl, but before I

RE: Script runs fine when passed args directly, not as stdin

2010-03-02 Thread Joseph L. Casale
I'm commenting on your code below with some general remarks. Not sure if this will fix your problem. Shlomi, I greatly appreciate your time going through this, I have undergone rewriting it from scratch with your suggestions. It was a script I copied from an existing one which was a bad idea:)

Script runs fine when passed args directly, not as stdin

2010-03-01 Thread Joseph L. Casale
Hi, I should state first I don't have the luxury of using Perl often and am super rusty:) I have a script that sends snmp commands to a switch either by passing args directly or as stdin. It works when passing them directly, but fails when feeding them as stdin, which is ultimately the way it

RE: Question on approach

2009-07-24 Thread Joseph L. Casale
I have no idea what was wrong with me last night. You are absolutely right, those are not in a sortable format. All the replies led me down the path of enlightenment:) The string before the @ will always be the same, in fact, I must error check for this, so no need for a hash, I can just apply

Question on approach

2009-07-23 Thread Joseph L. Casale
Hi, I have some data I will read into an array that is the format some_string@date such as foo/bar/b...@07-23-2009-11.42.02. To work with this, I will convert the date part (everything after the @ to the epoch format so it's easy to sort accurately. I figured I would create a hash with keys being

Re: Cannot resolve the read/write issue...

2009-04-17 Thread Joseph Mwesigwa Bbaale
assist. Joseph. -- Isaiah 40:31 But they that wait upon the LORD shall renew their strength...

Re: @array a copy of @names???

2009-04-02 Thread Joseph Mwesigwa Bbaale
Hello, I am a complete beginner - no programming background. I want to begin with Perl and I decided to by Randal's book *Learning Perl*. I seem to have been progressing smoothly till when I arrived at the code below on page 65. my @names = qw/ tom fred dan betty roy /; my $result =

debugging code that freezes

2008-03-05 Thread Joseph L. Casale
In another list, I am baffled by the instability of a Perl script that freezes after some time for a user. What can be done to run a Perl script in a debug like mode such that all system calls could be logged so that one could see what was attempted for execution by the script as it hung?

Expression Help

2008-02-27 Thread Joseph L. Casale
I am trying to replace all occurrences of a windows path such as C:\Dir 1\Dir 2\Dir with more spaces to a similar path, and have it case insensitive, and I can't make it work. Anyone got an idea? I am hoping the syntax is compatible with Sed as my script has to be ran in two mode's, one being

RE: Expression Help

2008-02-27 Thread Joseph L. Casale
I don't understand why you would run sed. Perl can be run from the command line by hand as well. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. Yeah, sorry should have been more clear. The server that will run the Sed based section

RE: Expression Help

2008-02-27 Thread Joseph L. Casale
How about providing the code that you are working with? This ought to work: s/C:\\Dir 1\\Dir 2\\Dir with more spaces/replacement/ __CODE__ $in = 'C:\Dir 1\Dir 2\Dir with more spaces'; $in =~ s/C:\\Dir 1\\Dir 2\\Dir with more spaces/replacement/; print $in\n; __OUTPUT__ replacement I had not

Suppressing output from backtick operator

2008-02-20 Thread Joseph L. Casale
How does one do this? I have the output in a script set to a variable such as: my $var = `cmd --arg1 --arg2 | egrep 'This|That'` and I don't want to see it as the script is run. Thank you, jlc -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Suppressing output from backtick operator

2008-02-20 Thread Joseph L. Casale
That should be one process not on process. It is important, and I forgot to add this, to use waitpid* to reap the child process after an open3 unless you don't mind zombies. * http://perldoc.perl.org/functions/waitpid.html Thank you Chas and yitzle jlc -- To unsubscribe, e-mail: [EMAIL

RE: Suppressing output from backtick operator

2008-02-20 Thread Joseph L. Casale
Suggestion: rather than use egrep (which, as Chas points out, requires a new process - and ignoring his solution for a moment - sorry), it might make more sense (and increase portability) to move the RegEx parsing into Perl. my $var = grep {/This|That/}, `cmd --arg1 --arg2; (Did I do this

Controlling external I/O with Perl

2008-01-13 Thread Joseph L. Casale
I have a need at work to monitor external I/O from a PC. Basically I need to turn outputs on and off and monitor some various inputs for different ranges. Since I know *some* Perl and the PC won't be doing anything else I am not worried about making sure the code is enterprise scalable. Is

RE: WinXP command prompt window scrolls very slow

2007-12-26 Thread Joseph L. Casale
I just loaded WinXP on my wife's computer. I hate that OS. So? It works for billions of other people and companies, what does that say? They are _all_ 'uninformed' and you are? Relevance to the issue? I just noticed that the command prompt window scrolls real slow. I did some searching and

Modifing Text Files

2007-10-25 Thread Joseph L. Casale
I need to make some edits on small (~30 lines) text files. From reading perldoc and recent posts, am I correct in understanding that the proper way is to read the file in through one handle and write it out through another? If that is the case, I suppose I need to write in some code then to

Read in XML File for input

2007-10-19 Thread Joseph L. Casale
My whole project got too messy so I decided to use an existing XML file to load in all the needed input I would require. I have the following code but fail to access to data in $workspace. my $workspace = XMLin($ARGV[0], forcearray = 1); print Dumper($workspace); print

RE: Size of a hash

2007-10-19 Thread Joseph L. Casale
does one write that? As an example While ($workspace-{stuff}) { print $workspace-{stuff}-{Iterated element}-{type}\n; } Thanks! jlc -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Phoenix Sent: October-19-07 3:32 PM To: Joseph L. Casale Cc

RE: Read in XML File for input

2007-10-19 Thread Joseph L. Casale
Is there a way to compute the size of a hash? I have a hash of hashes of hashes etc... and need to know how many items exist in the second hash. I know they are always named as integers from 0 up. I was hoping to get info I need out of with a loop incrementing up until etc. Does such a method

RE: Read in XML File for input

2007-10-19 Thread Joseph L. Casale
be a way to make sure I am reading the data I want? Send me another nudge :) Thanks! jlc -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Phoenix Sent: October-19-07 12:19 PM To: Joseph L. Casale Cc: beginners@perl.org Subject: Re: Read in XML File for input

RE: Printing size of array unitializes array?

2007-10-19 Thread Joseph L. Casale
Sorry, it is an array I used above this block of code. jlc -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of yitzle Sent: October-19-07 11:16 AM To: Joseph L. Casale Cc: beginners@perl.org Subject: Re: Printing size of array unitializes array? What are you

RE: Read in XML File for input

2007-10-19 Thread Joseph L. Casale
Now I got it... That was a bit of a stretch for my experience:) print $workspace-{TextHere}-[0]-{content}\n; Thanks! jlc -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Phoenix Sent: October-19-07 12:19 PM To: Joseph L. Casale Cc: beginners@perl.org

RE: Assemble file and directory name for copy

2007-10-19 Thread Joseph L. Casale
Thank you! jlc -Original Message- From: Paul Lalli [mailto:[EMAIL PROTECTED] Sent: October-19-07 10:35 AM To: beginners@perl.org Subject: Re: Assemble file and directory name for copy On Oct 19, 12:13 pm, [EMAIL PROTECTED] (Joseph L. Casale) wrote: I am using File::Path and need

Assemble file and directory name for copy

2007-10-19 Thread Joseph L. Casale
I am using File::Path and need to assemble a directory without a trailing backslash, $Dir and a file, $File for copy. I can't get the syntax right to assemble the path inside the copy? I need something like: Copy ($FromDir . \ . $File, $ToDir . \ . $File) Any ideas? Thanks! jlc

Printing size of array unitializes array?

2007-10-19 Thread Joseph L. Casale
I had the following code: open (FILEOUT, $OutDir/info) or die $!; print FILEOUT text = abc\n; my $Tmp = ++$#files; print FILEOUT moretext = $Tmp\n; When I add the 3rd line, it initializes the files array and I can't use it after? Why is that? I

Filtering output of readdir

2007-10-18 Thread Joseph L. Casale
Hi All, I am needing to perform some work on files located in a directory. I am reading the contents of the directory in and but need to filter what's read in. So far I can filter out the . and .. but I need to add two more cases. I need to make sure none of the entries in the array are

RE: Filtering output of readdir

2007-10-18 Thread Joseph L. Casale
Message- From: Chas. Owens [mailto:[EMAIL PROTECTED] Sent: October-18-07 2:53 PM To: Joseph L. Casale Cc: beginners@perl.org Subject: Re: Filtering output of readdir On 10/18/07, Joseph L. Casale [EMAIL PROTECTED] wrote: Hi All, I am needing to perform some work on files located in a directory

RE: Filtering output of readdir

2007-10-18 Thread Joseph L. Casale
Thanks Chas and Tom, its working great. jlc -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Reading files for values

2007-10-18 Thread Joseph L. Casale
I have to search for text strings in files and then do something with the line that matches in one scenario and in another I need to store the contents of the following n lines. In the first requirement I think I have it beat, but I am lost on the second. I thought I might be able to search

MP3 tag writing

2007-09-08 Thread Joseph L. Casale
I was following the previous mp3 thread with interest, does anyone know if there exists a module that can not only write tags but imbed the album art as well? Thanks! jlc

Rounding and Subs

2007-07-24 Thread Joseph L. Casale
Hi All, I have two questions, is it correct to execute subs like this: Sub_1 (sub_2))? I am trying to pass the return value of sub_2 into sub_1. Also, I have been looking at perldoc etc to limit the # of digits returned after a decimal, it looks difficult? Am I overlooking a simple method?

RE: Rounding and Subs

2007-07-24 Thread Joseph L. Casale
Nice! Thanks, jlc -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 24, 2007 10:24 AM To: Joseph L. Casale Cc: beginners@perl.org Subject: Re: Rounding and Subs On 7/24/07, Joseph L. Casale [EMAIL PROTECTED] wrote: Hi All, I have two questions

Scientific Number problem again!

2007-07-23 Thread Joseph L. Casale
Hi guys, I must have been dreaming when I tested this and ran it the first time as I thought it worked! Now it's not :P Anyone know what's wrong here, can I not leverage the expand sub to convert the scientific notation in the printf statement like I am? sub expand { my $n = shift;

RE: Scientific Number problem again!

2007-07-23 Thread Joseph L. Casale
Sorry, I am still getting the scientific notation in the output instead of standard notation. Thanks! jlc -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED] Sent: Monday, July 23, 2007 2:09 PM To: Joseph L. Casale Cc: beginners@perl.org Subject: Re: Scientific Number problem

RE: Scientific Number problem again!

2007-07-23 Thread Joseph L. Casale
Right! It can be either, I missed that... Thanks Chas! jlc -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED] Sent: Monday, July 23, 2007 2:18 PM To: Joseph L. Casale Cc: beginners@perl.org Subject: Re: Scientific Number problem again! On 7/23/07, Joseph L. Casale [EMAIL

RE: Extreme beginner question on reading lines from a file.

2007-07-18 Thread Joseph L. Casale
:08, Joseph L. Casale wrote: Is that true? I use while loops and they cycle through each line without me keeping track? jlc Yeah, it's true. Why would you want to keep track? (you can BTW, look at perldoc perlvar for $.) in my code, the 1st line is written into $prev. This code will fail

Convert Scientific Notation to decimal equivalent

2007-07-18 Thread Joseph L. Casale
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 0 -14.95313 -28.90625 0 -14.95313 -14.45313 0 -14.95313

RE: Convert Scientific Notation to decimal equivalent

2007-07-18 Thread Joseph L. Casale
Notation to decimal equivalent 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

RE: Convert Scientific Notation to decimal equivalent

2007-07-18 Thread Joseph L. Casale
Chas, Sorry but I am not clear on what you mean by reduce? Do you mean remove all non numbers from the array? Thanks! jlc -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 18, 2007 4:31 PM To: Joseph L. Casale Cc: Xavier Noria; beginners@perl.org

RE: Search and Replace

2007-07-13 Thread Joseph L. Casale
One of these scripts has a loop like this: for my $line (@lines){ my $line2 = $line; $line =~ s/(\S+)\s+(\S+)\s+(\S+)/X$1 Y$2/; print FILEOUT $line; $line2 =~ s/(\S+)\s+(\S+)\s+(\S+)/Z[$3+DPad]/; print FILEOUT $line2; print FILEOUT M98PDRILL.SUBL1\n; print FILEOUT G90\n; print FILEOUT G00

RE: Search and Replace

2007-07-13 Thread Joseph L. Casale
Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Friday, July 13, 2007 7:09 PM To: beginners@perl.org Cc: Joseph L. Casale Subject: Re: Search and Replace Joseph L. Casale wrote: One of these scripts has a loop like this: for my $line (@lines){ my $line2 = $line; $line =~ s/(\S

RE: Search and Replace

2007-07-12 Thread Joseph L. Casale
: Wednesday, July 11, 2007 4:52 PM To: Joseph L. Casale Cc: beginners@perl.org Subject: Re: Search and Replace Joseph L. Casale wrote: Paul, Reading the perlre doc I am starting to understand this line: $line =~ s/(\S+)\s+(\S+)\s+(\S+)/X$1 Y$2 Z$3/; I have a few questions. 1. What is the tilde

RE: Search and Replace

2007-07-12 Thread Joseph L. Casale
Ok Rob, I'll have a look. Thanks! jlc -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Thursday, July 12, 2007 1:22 PM To: beginners@perl.org Cc: Joseph L. Casale Subject: Re: Search and Replace Joseph L. Casale wrote: How can I make this expression: $line =~ s/(\S

Search and Replace

2007-07-11 Thread Joseph L. Casale
Hi, Know that I am learning perl, I am expected to use it at work :) Problem is I am still to green for the current problem I have. The data is always left justified and has a space between each value. I have a text file of about ~500 lines like this: -11.67326 23.95923 0.4617566 5.075023

RE: Search and Replace

2007-07-11 Thread Joseph L. Casale
To: beginners@perl.org Subject: Re: Search and Replace On Jul 11, 1:50 pm, [EMAIL PROTECTED] (Joseph L. Casale) wrote: Hi, Know that I am learning perl, I am expected to use it at work :) Problem is I am still to green for the current problem I have. The data is always left justified and has

RE: Search and Replace

2007-07-11 Thread Joseph L. Casale
-Original Message- From: Paul Lalli [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 11, 2007 12:30 PM To: beginners@perl.org Subject: Re: Search and Replace On Jul 11, 1:50 pm, [EMAIL PROTECTED] (Joseph L. Casale) wrote: Hi, Know that I am learning perl, I am expected to use it at work :) Problem

RE: syntax error of some sort?

2007-07-05 Thread Joseph L. Casale
Chas/Prabu, The script is moving along nicely now:) Incredible how I missed the obvious, although I have been staring at it for so long... Thanks! jlc -Original Message- From: Prabu Ayyappan [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 04, 2007 11:16 PM To: Joseph L. Casale

Proper way to halt a script

2007-07-05 Thread Joseph L. Casale
I am reading perldoc.perl.org and am not understanding exit and die clearly. If I have a conditional in a sub that I want to validate with, what is the correct way to do the following: 1. End the sub and return back to the script without continuing that sub. 2. End the entire

RE: formatting a string

2007-07-04 Thread Joseph L. Casale
Yup, lol... Wish I understood this! What is the line that does the search called? What do I look up to read up on this? Thanks! jlc From: Prabu Ayyappan [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 10:55 PM To: Joseph L. Casale; beginners@perl.org Subject: Re: formatting a string

foreach broken in my script

2007-07-04 Thread Joseph L. Casale
I have a list: @list = ('Exchange','Filter','DNS','Domain'); This is a list of arrays I also have of course to leverage this I am trying to . the @ symbol on it during use. foreach $vm (@list) { my_sub(@ . $vm); print @ . $vm\n; } The print likes this, but the

File::Spec-splitpath

2007-07-04 Thread Joseph L. Casale
Hi, I am trying to use the following: ($volume,$directories,$file) = File::Spechttp://perldoc.perl.org/File/Spec.html-splitpath( $path ); I am leveraging this fine, but would like to shove the last directory from the path in $directories into a new var. Is there a function from this module

RE: File::Spec-splitpath

2007-07-04 Thread Joseph L. Casale
Just found that. I suppose I could use it, then get the size of the array and use the last indices? Is there a cleaner way to do it? Thanks! jlc -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Phoenix Sent: Wednesday, July 04, 2007 1:38 PM To: Joseph

RE: File::Spec-splitpath

2007-07-04 Thread Joseph L. Casale
Dang, you perl guys thought of everything! Thanks! jlc From: Chas Owens [EMAIL PROTECTED] Sent: Wednesday, July 04, 2007 3:21 PM To: Joseph L. Casale Cc: Tom Phoenix; beginners@perl.org Subject: Re: File::Spec-splitpath On 7/4/07, Joseph L. Casale [EMAIL

syntax error of some sort?

2007-07-04 Thread Joseph L. Casale
I have the following code (it's a snippet so it may seem silly, but altogether it would make sense as I am forcing one array into it for a test): #!/usr/bin/perl -w @DNS = (/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/Web DNS (Win2003 Std x32)/Web DNS (Win2003 Std

RE: syntax error of some sort?

2007-07-04 Thread Joseph L. Casale
? So the `/usr/bin/vmware-cmd \$_[0]\ gettoolslastactive -q`; is correct where the var gets inserted? Thanks! jlc -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 04, 2007 8:15 PM To: Joseph L. Casale Cc: beginners@perl.org Subject: Re: syntax error

RE: syntax error of some sort?

2007-07-04 Thread Joseph L. Casale
Heh, I am running out of hair:P I get two errors to start, one is the warning that is better write: my ($vm) = $_[0]; instead of my ($vm) = @_[0]; And the other is about the use of the global @_ (huh) with my? I have this now: #!/usr/bin/perl -w @Exchange =

RE: syntax error of some sort?

2007-07-04 Thread Joseph L. Casale
Heh, Clearly I need to sleep! This doesn't even work either? #!/usr/bin/perl -w @list = (Exchange,Filter,DNS,Domain) sub stop_it { $vm = $_[0]; print $vm\n; } stop_it(@list) What is wrong here? jlc -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

formatting a string

2007-07-03 Thread Joseph L. Casale
I have an array with the following data in it: /vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/AN-DC (Win2003 Ent x64).vmx /vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc 1.vmdk /vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC

Conditional question

2007-07-02 Thread Joseph L. Casale
I want to script an if based on two conditions, var1=0 and var2=1. Is there some quicker way to write this in one if statement like: If ($var1=0 ?and? var2=1) { Do my stuff } I know I can nest a second if, but just hoped I could do it quicker :) Thanks! jlc

RE: Conditional question

2007-07-02 Thread Joseph L. Casale
: Monday, July 02, 2007 11:05 PM To: Joseph L. Casale Cc: beginners@perl.org Subject: Re: Conditional question On 7/3/07, Joseph L. Casale [EMAIL PROTECTED] wrote: I want to script an if based on two conditions, var1=0 and var2=1. Is there some quicker way to write this in one if statement like

Re: cmdline program to access s.m.a.r.t. data

2006-09-22 Thread joseph
you want to be extracted, it's nice also if you can provide a snippet of your effort. /joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: How to remove duplicates from a file ...

2006-08-23 Thread joseph
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, Hello, If I have a file that has ... A A B C D D D E E F F G How do I remove the duplicates via a Perl script? perldoc -q How can I remove duplicate elements from a list or array One way to do it:

Re: Comparing two files of 8million lines/rows ...

2006-08-16 Thread joseph
prefer using a script is so am not putting loads into the database not to mention that I can put more logic into the script than on the SQL statement. Any advise or other options will be very much appreciated Thanks in advance. welcome, HTH. /joseph -- To unsubscribe, e-mail: [EMAIL

Error handling on script

2006-07-24 Thread joseph tacuyan
Hi List, Again I need your help, script in question is here: #usr/local/perl -w use strict; use Socket; open(OUTPUT,iplisted.txt) or die can't open iplisted.txt $!; foreach (DATA) { s/\s+//; my $address = $_; my $name = gethostbyaddr(inet_aton($address), AF_INET) or die Can't

RE: Error handling on script(closed)

2006-07-24 Thread joseph tacuyan
Thomas B�tzler [EMAIL PROTECTED] wrote: Hi, joseph tacuyan asked: #usr/local/perl -w use strict; use Socket; open(OUTPUT,iplisted.txt) or die can't open iplisted.txt $!; foreach () { s/\s+//; my $address = $_; my $name = gethostbyaddr(inet_aton($address), AF_INET

Re: check existence of element in a list

2006-07-20 Thread joseph
Rob Dixon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] joseph wrote: Rob Dixon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] joseph wrote: I need help with my script, this supposedly would check a workstation listed in one file then see if it's not listed

check existence of element in a list

2006-07-19 Thread joseph
Hi list, I need help with my script, this supposedly would check a workstation listed in one file then see if it's not listed on other file, if it 's the case then append it on an output file.Basically what i got is the same unmodified list just appended on the output file. Where did i got

Re: check existence of element in a list

2006-07-19 Thread joseph
Jeff Peng [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] my %hash = map { $_ = 1 } @pclist; above is wrong.It should be: my %hash = map { $_, 1 } @pclist; HTH. Thank you Jeff, unfortunately still it didn't solve the problem. /jbt -- To unsubscribe, e-mail: [EMAIL

Re: check existence of element in a list

2006-07-19 Thread joseph
Rob Dixon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] joseph wrote: I need help with my script, this supposedly would check a workstation listed in one file then see if it's not listed on other file, if it 's the case then append it on an output file.Basically what i

logfile regex

2006-07-14 Thread joseph
. $$SMS_DISCOVERY_DATA_MANAGERFri Jul 14 13:22:00.977 2006 Malay Peninsula Standard Timethread=3480 (0xD98) ==Name = WKSMDE05612 TIA for any pointers and tips. /joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http

file script and cmd script difference

2006-06-29 Thread joseph
. /joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: file script and cmd script difference (close)

2006-06-29 Thread joseph
... for how many times i had checked it, what a hard learned lesson. thanks. /joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: Diff two files

2006-06-14 Thread joseph
Jeff Peng [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How about your two files?I should give a general way for comparing two files: use strict; open TXT1, 1.txt or die $!; open TXT2, 2.txt or die $!; my %diff; $diff{$_}=1 while (TXT2); while(TXT1){ print unless

Newline error

2006-06-06 Thread joseph
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 this error whenever i feed it up when an

Re: Newline error

2006-06-06 Thread joseph
Mr. Shawn H. Corey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, 2006-06-06 at 18:59 +0800, 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

Re: Newline error

2006-06-06 Thread joseph
John W. Krahn [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] joseph wrote: All, Hello, 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

Re: Newline error (Closed)

2006-06-06 Thread joseph
Muma W. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 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

Re: Newline error

2006-06-06 Thread joseph
Xavier Noria [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 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

Extracting a Range of Lines

2006-06-04 Thread joseph
logs. with my script above I got only the END_TIME/format/here section, I've tried also reading it by paragraph but to no avail, is there any modules or tricks to do the job? As always.thanks a lot. /joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: Extracting a Range of Lines

2006-06-04 Thread joseph
Mr. Shawn H. Corey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, 2006-05-06 at 08:51 +0800, joseph wrote: Hello List, I need help in extracting a range of lines from a log files, i tried to do it with this script: #!/bin/perl use strict; use warnings; open

Re: Extracting a Range of Lines

2006-06-04 Thread joseph
Mr. Shawn H. Corey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, 2006-05-06 at 10:20 +0800, joseph wrote: @line = () if /^DATE:/; ## set array @line to an empty list if line begin DATE? Yes, this will clear out the previous record. push @line, $_; ## then push

Re: Sendmail mail from script (Closed)

2006-06-02 Thread joseph
Hi Mandeep, Thanks a lot, your first option works i've just add another switch -v to mail for it looks for recepient address without it. Anyway, i will look at the second option too next. with thanks, /joseph íÁÎÄÉÐ óÉÎÇÈ âÈÁÂÈÁ [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED

Sendmail mail from script

2006-06-01 Thread joseph
List, Good day! I'm trying to rewrite a bash script into perl as to aid my learning experience.Supposedly this script would do these things; 1. Open the logfiles. 2. Check the last portion of files. 3. Check the log for an ERROR string. 4. If error is present mail.(I'm stuck here i dunno how

Learning Perl

2006-04-10 Thread joseph tacuyan
. /joseph perl convert. - Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.

Inhouse E-mail and others

2006-04-04 Thread Joseph Ruffino
will get this to be informed. -- Joseph A. Ruffino Gail Borden Public Library District Automated Systems Assistant 270 N. Grove Ave. Elgin, IL 60120 Phone: (847) 429-5986 Fax: (847) 602-5029 http://www.gailborden.info

Accidental E-mail

2006-04-04 Thread Joseph Ruffino
. -- Joseph A. Ruffino Gail Borden Public Library District Automated Systems Assistant 270 N. Grove Ave. Elgin, IL 60120 Phone: (847) 429-5986 Fax: (847) 602-5029 http://www.gailborden.info

  1   2   3   4   5   6   7   8   9   10   >