Re: Getting 2/8 as output
Thank you. I stand corrected. Interestingly, if you do perldoc -q $, it does not explain $, but instead goes into some system with as the prompt. Mike On 6/17/2015 8:43 AM, Andy Bach wrote: Actually there is a $, - array display separator. http://perlmaven.com/output-field-separator-and-list-separator On Wednesday, June 17, 2015, Mike Flannigan mikef...@att.net mailto:mikef...@att.net wrote: If I am not mistaken there is no $, variable in Perl. Correct me if I am wrong. I suspect that was supposed to be $/. Mike
Re: Getting 2/8 as output
On 06/17/2015 10:01 PM, Mike Flannigan wrote: Thank you. I stand corrected. Interestingly, if you do perldoc -q $, it does not explain $, but instead goes into some system with as the prompt. you need to escape the $ from the shell. also you can use perldoc -v to get info on any builtin variable: perldoc -v '$,' Handle-output_field_separator( EXPR ) $OUTPUT_FIELD_SEPARATOR $OFS $, The output field separator for the print operator. If defined, this value is printed between each of print's arguments. Default is undef. Mnemonic: what is printed when there is a , in your print statement. uri
Re: Getting 2/8 as output
On Wed, 17 Jun 2015 08:29:10 -0500 Mike Flannigan mikef...@att.net wrote: If I am not mistaken there is no $, variable in Perl. Correct me if I am wrong. http://perldoc.perl.org/perlvar.html and search for /\$OUTPUT_FIELD_SEPARATOR/ -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Getting 2/8 as output
If I am not mistaken there is no $, variable in Perl. Correct me if I am wrong. I suspect that was supposed to be $/. Mike On 6/17/2015 7:32 AM, beginners-digest-h...@perl.org wrote: { local $, = \n; print %test; } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Getting 2/8 as output
Actually there is a $, - array display separator. http://perlmaven.com/output-field-separator-and-list-separator On Wednesday, June 17, 2015, Mike Flannigan mikef...@att.net wrote: If I am not mistaken there is no $, variable in Perl. Correct me if I am wrong. I suspect that was supposed to be $/. Mike On 6/17/2015 7:32 AM, beginners-digest-h...@perl.org wrote: { local $, = \n; print %test; } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- a Andy Bach, afb...@gmail.com 608 658-1890 cell 608 261-5738 wk
Re: Getting 2/8 as output
See this http://stackoverflow.com/questions/6723172/what-is-4-16-in-hashes On 13-Jun-2015 10:09 pm, rakesh sharma rakeshsharm...@hotmail.com wrote: Hi I am printing a hash but I tried to concatenate the new line operator and I am getting 2/8 as output; print %hash.\n; output is 2/8. I am not able to make the output. 2 could be the items in the hash, which in my case was 2. Any inputs? thanks rakesh
Re: Getting 2/8 as output
Hi Sumathi, first of all note this: http://www.shlomifish.org/philosophy/computers/netiquette/email/start-new-thread.html On Mon, 15 Jun 2015 13:12:53 +0530 suMathI gOkuL sumathig2...@gmail.com wrote: Hi Friends, Please suggest me some idea to write perl code to join multiple lines into single line after a delimiter... For example i have the following code.. N22_pad_RNO : AO1 port map(A = un1_N3, B = N2_c, C = \N22_pad_RNO_0\, Y = \N22_pad_RNO\); N3_pad : INBUF port map(PAD = N3, Y = N3_c); and want to modify as follows.. N22_pad_RNO : AO1 port map(A = un1_N3, B = N2_c, C = \N22_pad_RNO_0\, Y = \N22_pad_RNO\); (in single line) N3_pad : INBUF port map(PAD = N3, Y = N3_c); Thank you all in advance This is easy to do using: 1. loops - see the while, for/foreach, etc. loops. 2. File I/O - or use some of the modules here - http://perl-begin.org/topics/files-and-directories/#modules . 3. String concatenation - see the . operator in http://perldoc.perl.org/perlop.html . 4. chomp - see http://perlmaven.com/chomp 5. Possibly using regular expression search and replace - see http://perl-begin.org/topics/regular-expressions/ == (*NOTE* : perl-begin.org is a site that I maintain). A good programmer should be able to know how to construct a program that does that out of all these mechanisms. Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ What Makes Software Apps High Quality - http://shlom.in/sw-quality Chuck Norris won the Nobel Peace Prize. For making millions of people rest in peace. — http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/ Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Getting 2/8 as output
{ local $, = \n; print %test; } On Sat, Jun 13, 2015 at 9:37 AM, rakesh sharma rakeshsharm...@hotmail.com wrote: Hi I am printing a hash but I tried to concatenate the new line operator and I am getting 2/8 as output; print %hash.\n; output is 2/8. I am not able to make the output. 2 could be the items in the hash, which in my case was 2. Any inputs? thanks rakesh
Re: Getting 2/8 as output
Hi Friends, Please suggest me some idea to write perl code to join multiple lines into single line after a delimiter... For example i have the following code.. N22_pad_RNO : AO1 port map(A = un1_N3, B = N2_c, C = \N22_pad_RNO_0\, Y = \N22_pad_RNO\); N3_pad : INBUF port map(PAD = N3, Y = N3_c); and want to modify as follows.. N22_pad_RNO : AO1 port map(A = un1_N3, B = N2_c, C = \N22_pad_RNO_0\, Y = \N22_pad_RNO\); (in single line) N3_pad : INBUF port map(PAD = N3, Y = N3_c); Thank you all in advance On Sat, Jun 13, 2015 at 10:33 PM, Илья Рассадин elcaml...@gmail.com wrote: Hi! You can use say instead of print (with use v5.10 as minimum) to avoid this strange behaviour. use v5.10; say %hash; but output still be ugly - all keys and values concatenates withoud delimeter. if you want to dump your hash for debugging purpose, module Data::Dumper is a great choice. use Data::Dumper; print Dumper \%hash; And last, you get output '2/8' because when you concatenate %hash with string, perl evaluates hash as scalar. More details you can find in that stackoverflow question http://stackoverflow.com/questions/7427381/what-do-you-get-if-you-evaluate-a-hash-in-scalar-context сб, 13 июня 2015 г. в 19:48, Raj Barath barat...@live.com: You can go over the hash using for loop like for ( keys %hash ){ print $_ = $hash{$_}. \n; } On Jun 13, 2015 1:40 PM, rakesh sharma rakeshsharm...@hotmail.com wrote: Hi I am printing a hash but I tried to concatenate the new line operator and I am getting 2/8 as output; print %hash.\n; output is 2/8. I am not able to make the output. 2 could be the items in the hash, which in my case was 2. Any inputs? thanks rakesh -- *Regards,* *Sumathi G,* *Research Scholar,* *HBNI, IGCAR.*
Getting 2/8 as output
Hi I am printing a hash but I tried to concatenate the new line operator and I am getting 2/8 as output; print %hash.\n; output is 2/8. I am not able to make the output. 2 could be the items in the hash, which in my case was 2.Any inputs? thanksrakesh
Re: Getting 2/8 as output
You can go over the hash using for loop like for ( keys %hash ){ print $_ = $hash{$_}. \n; } On Jun 13, 2015 1:40 PM, rakesh sharma rakeshsharm...@hotmail.com wrote: Hi I am printing a hash but I tried to concatenate the new line operator and I am getting 2/8 as output; print %hash.\n; output is 2/8. I am not able to make the output. 2 could be the items in the hash, which in my case was 2. Any inputs? thanks rakesh
Re: Getting 2/8 as output
Hi! You can use say instead of print (with use v5.10 as minimum) to avoid this strange behaviour. use v5.10; say %hash; but output still be ugly - all keys and values concatenates withoud delimeter. if you want to dump your hash for debugging purpose, module Data::Dumper is a great choice. use Data::Dumper; print Dumper \%hash; And last, you get output '2/8' because when you concatenate %hash with string, perl evaluates hash as scalar. More details you can find in that stackoverflow question http://stackoverflow.com/questions/7427381/what-do-you-get-if-you-evaluate-a-hash-in-scalar-context сб, 13 июня 2015 г. в 19:48, Raj Barath barat...@live.com: You can go over the hash using for loop like for ( keys %hash ){ print $_ = $hash{$_}. \n; } On Jun 13, 2015 1:40 PM, rakesh sharma rakeshsharm...@hotmail.com wrote: Hi I am printing a hash but I tried to concatenate the new line operator and I am getting 2/8 as output; print %hash.\n; output is 2/8. I am not able to make the output. 2 could be the items in the hash, which in my case was 2. Any inputs? thanks rakesh