Perl Diamond Operator


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl Diamond Operator
# 1  
Old 08-14-2010
Perl Diamond Operator

I know that when using 'while (<FILE>) {}', Perl reads only one line of the file at one time, and store it in '$_'.

Can I change some parameters so that 'while (<>) {}' can read more than one lines, like 2 or 5 lines at one time?

Thanks for the help!
# 2  
Old 08-14-2010
I am not a Perl monk but as far as I know the answer is no.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To print diamond asterisk pattern based on inputs

I have to print the number of stars that increases on each line from the minimum number until it reaches the maximum number, and then decreases until it goes back to the minimum number. After printing out the lines of stars, it should also print the total number of stars printed. I have tried... (13 Replies)
Discussion started by: rohit_shinez
13 Replies

2. Shell Programming and Scripting

awk diamond code golf (just for fun!)

Hey guys, This is purely just a little bit of fun with awk. I realize this this isn't that constructive so please remove if need be. Your goal: Create a one line awk script that generates a diamond shape of any size. Both the size of the diamond (measured by its middle line) and the... (7 Replies)
Discussion started by: pilnet101
7 Replies

3. Shell Programming and Scripting

Equivalent to Perl's and Bash's "=~" Operator?

Hello All, Alright, so this is driving me absolutely insane. I can't seem to find this ANYWHERE... I've tried every combination and synonym I can think of for this trying to search Google. What is the Expect/Tcl equivalent to Perl and Bash's "=~" operator, (i.e. the "contains" operator).... (2 Replies)
Discussion started by: mrm5102
2 Replies

4. Shell Programming and Scripting

perl's substitution operator "s" with file contents?

Please show me how to make substitution over the contents of a file in a perl script. In a perl script, the core part of substitution operation is s/FINDPATTERN/REPLACEPATTERN/g; However, I cannot figure out how to make the substitution occur over the contents of a file. The following... (3 Replies)
Discussion started by: LessNux
3 Replies

5. UNIX for Dummies Questions & Answers

+= operator

im new to bash scripting and im just using online tutorials and trial and error. i wanted to write a script to read numbers from a file and find their sum: #!/bin/bash theSum=0 for line in $(cat numbers.txt) do let "theSum = theSum + $line" echo "$line" done echo "The sum is... (3 Replies)
Discussion started by: astrolux444
3 Replies

6. Shell Programming and Scripting

chomp like Perl operator in Bash

I am sure there should exist a chomp like Perl operator in Bash using which I can literally remove new line characters as show below: Any clue? (3 Replies)
Discussion started by: paragkalra
3 Replies

7. Shell Programming and Scripting

Diamond operator in Until Statement (perl)

Hello: I have the following perl script which is giving me trouble inside the second elsif statement. The purpose of the script is to go through a file and print out only those lines which contain pertinent information. The tricky part came when I realized that certain items actually spanned... (5 Replies)
Discussion started by: erichpowell
5 Replies

8. Shell Programming and Scripting

scalar variable assignment in perl + { operator

When reading over some perl code in a software document, I came across an assignment statement like this $PATH = ${PROJECT}/......./.... In this particular form of scalar variable assignment, what does the curly braces operators do ? Also, what is the benefit in doing scalar assignment this... (3 Replies)
Discussion started by: JamesGoh
3 Replies
Login or Register to Ask a Question