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

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/

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: beginners-unsubscr...@pe

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 unsubscr

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 ne

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: beginners-unsubscr.

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

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, e-

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.o

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
>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

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 unc

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 e

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 need

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 appl

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 key

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

2009-04-17 Thread Joseph Mwesigwa Bbaale
e original line in outFile* I was expecting to find this line as well: *This goes into inFile*, in the "outFile"l. It seems between the "*open(IN...)*" and "*close(OUT)*" something is not working but I cannot figure it out. Please 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 = &which_elem

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? Thank

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 h

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 secti

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: 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

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: [

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] http://

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 there

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 writ

RE: Size of a hash

2007-10-19 Thread Joseph L. Casale
up) I would use a while/each, so how 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 PROTECT

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 e

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. C

RE: Read in XML File for input

2007-10-19 Thread Joseph L. Casale
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

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 "$workspace->{TextHere}->

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

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

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

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 for

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/

RE: Filtering output of readdir

2007-10-18 Thread Joseph L. Casale
ts. Thanks! jlc -Original 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 needi

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 dir

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

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 ques

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? Thank

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 <[EM

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

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: 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: 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.9

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 1.570813E-

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

2007-07-18 Thread Joseph L. Casale
question on reading lines from a file. On Wednesday 18 July 2007 17: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 perlv

RE: Search and Replace

2007-07-13 Thread Joseph L. Casale
$!; So using your syntax escapes me at the moment:) Thanks! jlc -Original 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

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

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: &

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. &

RE: Search and Replace

2007-07-11 Thread Joseph L. Casale
hanks! jlc -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 t

RE: Search and Replace

2007-07-11 Thread Joseph L. Casale
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 is I am still to green for the current problem I have. The data is > always left

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 24.2793

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 scrip

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

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

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 = ("/vmfs/volumes/467f06a5-7d59c067-35

RE: syntax error of some sort?

2007-07-04 Thread Joseph L. Casale
OK Chase, I saw the missing quotes:) I sniped out the later work using the other elements of the array as to much was broken! I do want to pass in an array and work with all of it. So if I wanted to work with only the first indices to start, is this correct: sub stop_it { my ($vm) = @_[0];

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: synta

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 x32).vmx","/vmfs/vol

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. Cas

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

File::Spec->splitpath

2007-07-04 Thread Joseph L. Casale
Hi, I am trying to use the following: ($volume,$directories,$file) = File::Spec->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

foreach broken in my script

2007-07-03 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, bu

RE: formatting a string

2007-07-03 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 A

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 (Win2

RE: Conditional question

2007-07-02 Thread Joseph L. Casale
Owens [mailto:[EMAIL PROTECTED] Sent: 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. >

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: cmdline program to access s.m.a.r.t. data

2006-09-22 Thread joseph
, Kindly specify or paste a sample format ouput of your monitoring tools, and which portion 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

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

2006-08-16 Thread joseph
is > a variable. > > Why I 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 PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

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 $

Error handling on script

2006-07-23 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 () { s/\s+//; my $address = $_; my $name = gethostbyaddr(inet_aton($address), AF_INET) or die "Can't reso

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: > >> > >>>

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, i

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

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 wro

logfile regex

2006-07-13 Thread joseph
DiscoverySource::VerifyClientPublicKeys - Public key does not exist for client GUID:4EFB420C-07F6-4E47-9472-AC20C0AF613B. $$ ==>Name = 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://learn.perl.org/first-response>

Re: file script and cmd script difference (close)

2006-06-29 Thread joseph
gt; > You have lost the '\' before 's+' in your regex. > > ouch... 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>

file script and cmd script difference

2006-06-28 Thread joseph
x27;t produce the same thing, why? Again thanks in advance. /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 (); > > while(){ > p

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

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. >> >>

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

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 &

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 existing

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

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 &

Extracting a Range of Lines

2006-06-04 Thread joseph
this log append the previous date 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 PR

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]>

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
input from keyboard. plz enlighten. /joseph perl convert. - Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.

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   >