Re: issue with perl map function

2011-12-03 Thread John W. Krahn
Alexandre Chapoutot wrote: Hi all, I think you should use grep instead of map in this partciluar case I disagree. I also don't think you should top-post your replies. John -- Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage t

Re: issue with perl map function

2011-12-03 Thread Dr.Ruud
On 2011-12-03 13:38, Binish A.R wrote: split(/\s+/, $_)[1] Why put all these extra characters in? ( split )[ 1 ] But if you happen to like extra characters, here are some: echo '1 2 3 4' |perl -anle 'do{s/\((.)\)/$1/g;1while s{([+-])\((...)\)}{$1$2}||s/\(\(([^{}]+)\)\)/($1)/||s/\((.x.)\

Re: issue with perl map function

2011-12-03 Thread Adams Paul
Sent from my LG phone Paul Johnson wrote: >On Fri, Dec 02, 2011 at 04:39:20AM -0500, sunita.prad...@emc.com wrote: >> Hi All >> >> My array @sympd_list has following lines : >> >> /dev/sdd 0BE0 07F:0 08C:D0 Unprotected N/Grp'd RW

Re: issue with perl map function

2011-12-03 Thread Binish A.R
Isn't this all as simple as a split on each element? Something like: @sympd_dev_list = map { (split(/\s+/, $_)[1] } @sympd_list;   http://www.gnome.org/friends/banners/associate.png"; alt="Become a Friend of GNOME" border="0" /> From: "sunita.prad...@emc.com"

Re: issue with perl map function

2011-12-03 Thread Alexandre Chapoutot
Hi all, I think you should use grep instead of map in this partciluar case Regards Alex 2011/12/2 : > Hi All > >                My  array  @sympd_list has  following lines : > > /dev/sdd               0BE0 07F:0 08C:D0  Unprotected   N/Grp'd      RW     > 500 > /dev/sde  

Re: issue with perl array code

2011-12-02 Thread Brandon McCaig
On Fri, Dec 02, 2011 at 01:24:05AM -0500, sunita.prad...@emc.com wrote: > Hi All Hello: > I have following code set of code which will have a > subroutine which has 2 parameters. The first parameter > (VALUES) is a reference to an array of non-sorted, hex strings. > The second parameter (RANGE

Re: issue with perl map function

2011-12-02 Thread John W. Krahn
sunita.prad...@emc.com wrote: Hi All Hello, My array @sympd_list has following lines : /dev/sdd 0BE0 07F:0 08C:D0 Unprotected N/Grp'd RW 500 /dev/sde 0BE1 07F:0 07A:C0 Unprotected N/Grp'd RW 500 /dev/

Re: issue with perl array code

2011-12-02 Thread Rob Dixon
On 02/12/2011 06:24, sunita.prad...@emc.com wrote: Hi All I have following code set of code which will have a subroutine which has 2 parameters. The first parameter (VALUES) is a reference to an array of non-sorted, hex strings. The second parameter (RANGES) is a reference to an array that is em

Re: issue with perl map function

2011-12-02 Thread Rob Dixon
On 02/12/2011 11:20, timothy adigun wrote: Hi Sunita, On Fri, Dec 02, 2011 at 04:39:20AM -0500, sunita.prad...@emc.com wrote: Hi All My array @sympd_list has following lines : /dev/sdd 0BE0 07F:0 08C:D0 Unprotected N/Grp'd RW

Re: issue with perl map function

2011-12-02 Thread timothy adigun
Hi Sunita, On Fri, Dec 02, 2011 at 04:39:20AM -0500, sunita.prad...@emc.com wrote: > > Hi All > > > > My array @sympd_list has following lines : > > > > /dev/sdd 0BE0 07F:0 08C:D0 Unprotected N/Grp'd RW > 500 > > /dev/sde

Re: issue with perl array code

2011-12-02 Thread Shlomi Fish
Hello Sunita, I'm replying to the list because I assume your question was meant to be public. On Fri, 2 Dec 2011 04:14:47 -0500 wrote: > Thank you Fish . I think , my question was not clear enough . In the array > "@array = > ("0A0", "005", "001", "004", "0BC", "004", "002", "001");" , "0BC

Re: issue with perl map function

2011-12-02 Thread Paul Johnson
On Fri, Dec 02, 2011 at 04:39:20AM -0500, sunita.prad...@emc.com wrote: > Hi All > > My array @sympd_list has following lines : > > /dev/sdd 0BE0 07F:0 08C:D0 Unprotected N/Grp'd RW > 500 > /dev/sde 0BE1 07F:0 07A:C0

Re: issue with perl array code

2011-12-01 Thread Shlomi Fish
Hi Sunita, On Fri, 2 Dec 2011 01:24:05 -0500 wrote: > Hi All > > I have following code set of code which will have a > subroutine which has 2 parameters. The first parameter (VALUES) is a > reference to an array of non-sorted, hex strings. The second parameter > (RANGES)

Re: issue with a multidimensional hash .. unable recreate the desired hash

2011-06-04 Thread Shlomi Fish
On Saturday 04 Jun 2011 14:44:11 Agnello George wrote: > hi > i have the following hash as out put from a sql query > > VAR1 = [ { '16' => { 'srch_type_id' => '162', 'rid' => '2' }, '13' => { > 'srch_type_id' => '123', 'rid' => '1' }, '17' => { 'srch_type_id' => > '147', 'rid' => '2' }, '15' =>

Re: issue wit sysopen

2011-04-10 Thread Shawn H Corey
On 11-04-10 06:06 AM, John W. Krahn wrote: Values that get bitwise ANDed together. That would be "ORed together". ;) -- Just my 0.0002 million dollars worth, Shawn Confusion is the first step of understanding. Programming is as much about organization and communication as it is about

Re: issue wit sysopen

2011-04-10 Thread John W. Krahn
Shlomi Fish wrote: On Sunday 10 Apr 2011 11:03:51 Sunita Rani Pradhan wrote: $i =~ s/d|b/G/ig; Thsi should be : $line =~ s/[db]/G/ig; Or possibly even: $line =~ tr/dbDB/G/; John -- Any intelligent fool can make things bigger and more complex... It takes a

Re: issue wit sysopen

2011-04-10 Thread John W. Krahn
shawn wilson wrote: On Apr 10, 2011 4:05 AM, "Sunita Rani Pradhan" wrote: sysopen(DATA,"list1.txt",O_RDWR|O_TRUNC); Why not just use open with +< ? I've never seen the benefit of sysopen unless you're working with a stream. Also, I don't know those options are compatible with each other.

Re: issue wit sysopen

2011-04-10 Thread shawn wilson
On Apr 10, 2011 4:05 AM, "Sunita Rani Pradhan" wrote: > > sysopen(DATA,"list1.txt",O_RDWR|O_TRUNC); > Why not just use open with +< ? I've never seen the benefit of sysopen unless you're working with a stream. Also, I don't know those options are compatible with each other. > It is failing with

Re: issue wit sysopen

2011-04-10 Thread Shlomi Fish
Hi Sunita. A few comments on your code. On Sunday 10 Apr 2011 11:03:51 Sunita Rani Pradhan wrote: > Hi All > > > > I have following simple code : > > > > === > > use warnings; > Add "use strict;". > > > sysopen(DATA,"list1.txt",O_RDWR|O_TRUNC); 1. Don't us

Re: issue with dereferencing a hash

2010-11-04 Thread galeb abu-ali
thanks, you're right. I took another look at the data structure and got the script to work. On Wed, Nov 3, 2010 at 6:07 PM, Jim Gibson wrote: > On 11/3/10 Wed Nov 3, 2010 1:13 PM, "galeb abu-ali" > > scribbled: > > > Hi, > > > > I'm parsing an xml file and get an error when dereferencing a ha

Re: issue with dereferencing a hash

2010-11-03 Thread Jim Gibson
On 11/3/10 Wed Nov 3, 2010 1:13 PM, "galeb abu-ali" scribbled: > Hi, > > I'm parsing an xml file and get an error when dereferencing a hash. I get an > error saying "Not a HASH reference as line 15." > Not sure where my syntax is off. Your syntax is fine. What is wrong is that one of the elem

Re: issue command once connected IRC

2008-12-04 Thread blake askew
Seems I was a little too hasty. I was able to change the numerical values the code was using in connecting to get what I wanted. Now I just need to figure out how to disconnect once successfully connected. Please let me know if anyone has any ideas about how I should accomplish this. Thanks On Fri

Re: Issue with references and array slice with one member !

2008-10-31 Thread Chas. Owens
On Fri, Oct 31, 2008 at 05:46, Amit Saxena <[EMAIL PROTECTED]> wrote: snip > I used "${$row}[0]", "${$row}[1]" etc one by one to get all the columns for > a particular code. On one of the production code which I am working, they > have used "@{$row}[0]" , "@{$row}[0]" instead of earlier. The result

Re: issue with my subroutine/library script.

2008-09-03 Thread Mr. Shawn H. Corey
On Wed, 2008-09-03 at 12:51 -0700, Raul Ruiz Jr. wrote: > I created a card shuffling program and it works fine. However, for my project > I am to place the shuffling part of my code in a separate script as a > subroutine. > > I am to remove the code > that does the shuffling and include it as a

Re: Issue with my subroutine/library script.

2008-09-03 Thread Raja Vadlamudi
On 9/3/08 4:01 PM, "Raul Ruiz Jr." <[EMAIL PROTECTED]> wrote: > I created a card shuffling program and it works > fine. However, for my project I am to place the shuffling part of my > code in a separate script as a subroutine. > > I am to remove the code > that does the shuffling and include

Re: Issue

2008-02-11 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi, Hello, I am learning to print two arrays in a single file but unable to do. So, I am printing it in two files. Any ideas Instead of using two arrays just use one Array of Arrays. # Populating the arrays @alphaid and @betaid foreach my $line (@File1) You

Re: Issue

2008-02-11 Thread David Moreno
Apparently, you are rewriting the value of the @alphaid and @betaid arrays on each of the loops after the s///. What are you trying to do with: @alphaid = $line; push(@alphaid,$_); I'd try only: push(@alphaid, $line); if I understood correctly. Cheers, David. On Feb 11, 2008 3:11 PM, <[EMAIL

Re: Issue

2008-02-11 Thread Gunnar Hjalmarsson
Chas. Owens wrote: If you want to print out only pairs you can use the code below. If you want to print out all of the items in the the longer array, then change the <= to >= In that case you'd better prevent Perl from spitting out uninitialized warnings... #!/usr/bin/perl use strict; use

Re: Issue

2008-02-11 Thread Chas. Owens
On Feb 11, 2008 3:11 PM, <[EMAIL PROTECTED]> wrote: > Hi, > I am learning to print two arrays in a single file but unable to > do. So, I am printing it in two files. Any ideas > > # Populating the arrays @alphaid and @betaid > foreach my $line (@File1) > { > if ($line =~ /^AC/) >

Re: Issue

2008-02-11 Thread Kashif Salman
I am sure there are better ways as I am learning as well, but how about doing something like this. This is assuming both arrays have the same number of elements. open MYFILE, ">>f1.txt"; for (0..$#alpha) { print MYFILE "$alphaid[$_]\t"; print MYFILE "$betaid[$_]\n"; } On Feb 11, 2008 12:1

Re: Issue while calling the subroutine dynamically

2007-11-07 Thread [EMAIL PROTECTED]
On Nov 6, 6:08 pm, [EMAIL PROTECTED] (Chas. Owens) wrote: > On 11/6/07, Ab <[EMAIL PROTECTED]> wrote: > snip> Now, The thing I am trying to achieve is to call abhinav::test::test2 > > on the runtime. > > ie, I am passing the value 'abhinav::test::test2' in a variable, and > > trying to exec in the

Re: Issue while calling the subroutine dynamically

2007-11-06 Thread Chas. Owens
On 11/6/07, Ab <[EMAIL PROTECTED]> wrote: snip > Now, The thing I am trying to achieve is to call abhinav::test::test2 > on the runtime. > ie, I am passing the value 'abhinav::test::test2' in a variable, and > trying to exec in the code below, and this place I am failing. > Can someone help me as t

Re: Issue while calling the subroutine dynamically

2007-11-06 Thread John W . Krahn
On Tuesday 06 November 2007 00:40, Ab wrote: > I have a package with the following contents. > --- > package abhinav::test; > > use strict; > use warnings; > > sub test1 > { > return "\nHello World"; > } > > sub test2 > { > my ($include) = @_; > foreach my $row (@$

Re: Issue

2003-10-30 Thread Gary Stainburn
On Wednesday 29 Oct 2003 7:35 pm, [EMAIL PROTECTED] wrote: > Hi, > > It has come to my attention that I need a little understanding > of what I'm doing here. Gary has provide some overview but not > Technical detail as I would like to have. That isn't his fault. > I admire his feedback for

RE: Issue

2003-10-29 Thread Bruce_Phillip
Hi, It has come to my attention that I need a little understanding of what I'm doing here. Gary has provide some overview but not Technical detail as I would like to have. That isn't his fault. I admire his feedback for sure. The code is obvious using hash. This is something I think I n

RE: Issue

2003-10-29 Thread Bruce_Phillip
return @lines; } I have reduce for now the get_response routine like the above. I know it works cause I print the $OS variable and it is correct. But what is funny. Your last line statement should have printed Something but the results was nothing. So what am I doing wrong? Phillip -Original M

RE: Issue

2003-10-28 Thread Bruce_Phillip
EMAIL PROTECTED] Sent: Tuesday, October 28, 2003 3:04 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Issue On Tuesday 28 Oct 2003 5:42 pm, [EMAIL PROTECTED] wrote: > Gary, > >I think your closer to what I was thinking of. >It makes more sense. Currently, This is what I

Re: Issue

2003-10-28 Thread Gary Stainburn
On Tuesday 28 Oct 2003 7:20 pm, you wrote: > Gary, > >While your structure make sense. I'm a little lost here. > >Do you mind given me the basic on the my %whichos > >I don't think I've ever come across this before and need some >Explaination on that. > >Thanks > Phillip > [snip

Re: Issue

2003-10-28 Thread Gary Stainburn
;}))[0]; print OUTPUT_FH ",$hostname"; etc.. If course, if you made the subroutine only return a single value, it would be cleaner to call. [snip] > > So far this is only testing the solaris commands on the network > I have access to. I appreciate any other comments you

RE: Issue

2003-10-28 Thread Bruce_Phillip
ink Gary has pointed out something for me to look at. Phillip -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 28, 2003 8:44 AM To: [EMAIL PROTECTED] Subject: Re: Issue <[EMAIL PROTECTED]> wrote: > > Rob Dixon wrote: > > > > Bob Sh

Re: Issue

2003-10-28 Thread Rob Dixon
<[EMAIL PROTECTED]> wrote: > > Rob Dixon wrote: > > > > Bob Showalter wrote: > > > > > > This sounds fine in principle. Many of the standard Perl > > > modules do this kind of thing. You use the built-in $^O > > > variable to detect the operating system. If you want to > > > see > > > an example, d

Re: Issue

2003-10-28 Thread Gary Stainburn
On Monday 27 Oct 2003 7:32 pm, [EMAIL PROTECTED] wrote: > Hi, > > I'm trying to accomplish some task using perl. So let > me describe what I have. > > I have several systems of the following: > > Unix: > Sun - Solaris > HP - HPUX > > Windows: > Dell - W

RE: Issue

2003-10-28 Thread Bruce_Phillip
totally Defeat the purpose of the scripts. If you don't know about CPAN then Look at http://www.cpan.org. That is where I got the Net::Telnet module from. Phillip -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 28, 2003 12:54 AM To: [EMA

Re: Issue

2003-10-28 Thread Rob Dixon
Bruce Phillip wrote: > > Thanks for the feedback, The only thing is that $O^ will only > work if the scripts are going to be invoke on that system. > > My plans are to run the perl script from one location and go > and discover the systems and their configuration. I'll be using > Net::Telnet m

RE: Issue

2003-10-27 Thread Bruce_Phillip
th to connect to systems in order to get those configs. Any other suggestions is welcomed. Phillip -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 12:25 PM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: Issue [

RE: Issue

2003-10-27 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Hi, > > > > I'm trying to accomplish some task using perl. So let > > me describe what I have. > > > > I have several systems of the following: > > > > Unix: > > Sun - Solaris > > HP - HPUX > > > > Windows: > >

Re: issue with chomp - chop need to trim()

2002-09-10 Thread david
Janek Schleicher wrote: > That's why the first one is only a matching, > while the second one is a substitution, > really removing something. > the first one is actually a syntax error. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: issue with chomp - chop need to trim()

2002-09-10 Thread Sudarshan Raghavan
> the chomp(EXP) function remove the last character from EXP(or $_) only if > that character is a newline for your OS. chomp() knows what newline your OS > uses so you don't have to worry about it. again, chomp doesn't remove > spaces(unless you happen to treat newline and space is the same).

Re: issue with chomp - chop need to trim()

2002-09-09 Thread Janek Schleicher
David wrote at Tue, 10 Sep 2002 03:22:52 +0200: >>> $line =~ /^\s+//; >> >>> $line =~ s/^\s+//; ^ > > even after looking at your reply for 20 seconds, i still didn't see the > differences... :-) how stupid i am? thanks for spot that. The difference is that the first one doesn't h

Re: issue with chomp - chop need to trim()

2002-09-09 Thread rob
david wrote: >the chop(EXP) function always remove the last character (or byte if you are >dealing with ASCII test only) from the applied EXP or $_ if EXP is omitted. >it doesn't care what that character is. it's true that if you happen to have >a single space at the end of your string, chop wi

Re: issue with chomp - chop need to trim()

2002-09-09 Thread david
John W. Krahn wrote: >> $line =~ /^\s+//; > >> $line =~ s/^\s+//; even after looking at your reply for 20 seconds, i still didn't see the differences... :-) how stupid i am? thanks for spot that. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROT

Re: issue with chomp - chop need to trim()

2002-09-09 Thread Michael Fowler
On Mon, Sep 09, 2002 at 08:04:24PM -0500, dizzy74 wrote: [snip] > I did perldoc -q trim and nothing. Of course chop and chomp were there > but diddnt seem to work in a pinch (or I couldnt understand how to apply > the function in my case. The FAQ entry you're looking for is perldoc -q 'strip

Re: issue with chomp - chop need to trim()

2002-09-09 Thread John W. Krahn
David wrote: > > to trim spaces, try: > > $line ="\t\tabcd\t \t\n"; > $line =~ /^\s+//; $line =~ s/^\s+//; > $line =~ /\s+$//; #-- also remove \n $line =~ s/\s+$//; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-ma

Re: issue with chomp - chop need to trim()

2002-09-09 Thread John W. Krahn
Dizzy74 wrote: > > Hi All Hello, > Today I was trying to do some work with perl and needed to use a > function that would trim leading or trailing spaces from a string. perldoc -q "blank space" Found in /usr/lib/perl5/5.6.0/pod/perlfaq4.pod How do I strip blank space from the begi

Re: issue with chomp - chop need to trim()

2002-09-09 Thread david
Dizzy74 wrote: > > open(FILE,"F:\\test_db\\Admin\\MINIHI\\DEF\\prog_list.txt"|| die "cant > open file") ; > chomp(@tblname = ); > open (outfile, ">F:\\test_db\\Admin\\MINIHI\\DEF\\INSERTprog_list.sql"|| > die "cant open file") ; > foreach $progid (@tblname) { > > $progid =~ s/\s+$

Re: Issue Unix command in Perl and get back the result

2002-01-02 Thread John W. Krahn
Families Laws wrote: > > The Unix command is: `cp -ip $file1 $file2`. I needed > to know if the cp operation is successful. I tried > $result = `cp -ip $file1 $file2`; > $result does not contain any value after the execution > even when $file1 does not exist. > > How can I find out if the 'cp' o

Re: Issue Unix command in Perl and get back the result

2002-01-02 Thread Peter Scott
At 10:21 PM 1/2/02 -0800, Families Laws wrote: >The Unix command is: `cp -ip $file1 $file2`. I needed >to know if the cp operation is successful. I tried >$result = `cp -ip $file1 $file2`; >$result does not contain any value after the execution >even when $file1 does not exist. > >How can I find o