Click here to get back home

Read 20 lines when pressing n for next

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Read 20 lines when pressing n for next s9uzaa 04-29-2008
Posted by A. Sinan Unur on April 30, 2008, 1:51 pm
Please log in for more thread options

>> s9uzaa@gmail.com wrote in news:37b9eb38-e188-4dc2-b3a7-
>> 5f09cc3b81ea@a70g2000hsh.googlegroups.com:
>>
>>> I would like to write a perl script with the following criteria
>>> match.
>>
>> Give it a shot. Then post any questions you might encounter (please
>> read the posting guidelines first).
>>
>>> 1. open any text file taken the name from the command line.
>>> 2. read top 20 lines and stops, then
>>> 3. ask to press letter "n or p" (for next/previous) to print next or
>>> previous 20 lines.
>>> would appreciate any kind of help.
>>> 4. must have subroutine used.
>>
>> Look up $. in perldoc perlvar
>>
> I got $5 that says this is homework. "must have subroutine used" is
> a dead giveaway.

Agreed. Which is why he does not get any fish before showing his
attempts at fishing for himself ;-)

Sinan

--
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/

Posted by Gordon Etly on May 1, 2008, 1:59 am
Please log in for more thread options
A. Sinan Unur wrote:
>
> > > s9uzaa@gmail.com wrote in news:37b9eb38-e188-4dc2-b3a7-
> > > 5f09cc3b81ea@a70g2000hsh.googlegroups.com:
> > >
> > > > I would like to write a perl script with the following criteria
> > > > match.
> > >
> > > Give it a shot. Then post any questions you might encounter
> > > (please
> > > read the posting guidelines first).
> > >
> > > > 1. open any text file taken the name from the command line.
> > > > 2. read top 20 lines and stops, then
> > > > 3. ask to press letter "n or p" (for next/previous) to print
> > > > next
> > > > or previous 20 lines.
> > > > would appreciate any kind of help.
> > > > 4. must have subroutine used.
> > >
> > > Look up $. in perldoc perlvar
> > >
> > I got $5 that says this is homework. "must have subroutine used" is
> > a dead giveaway.
>
> Agreed. Which is why he does not get any fish before showing his
> attempts at fishing for himself ;-)

Why do you all just assume it's a homework assignment? Could it not just
as well be a simplified work project? I would not be at all surprised if
this was something handed down by one's boss or project manager, and
written in a simplified form (which is what one *should* do, no?) I
really see little point to make such an assumption, and I'm sure no one
likes being talked down to.

--
G.Etly



Posted by Uri Guttman on May 1, 2008, 3:08 am
Please log in for more thread options

>> > > > 1. open any text file taken the name from the command line.
>> > > > 2. read top 20 lines and stops, then
>> > > > 3. ask to press letter "n or p" (for next/previous) to print
>> > > > next
>> > > > or previous 20 lines.
>> > > > would appreciate any kind of help.
>> > > > 4. must have subroutine used.

GE> Why do you all just assume it's a homework assignment? Could it
GE> not just as well be a simplified work project? I would not be at
GE> all surprised if this was something handed down by one's boss or
GE> project manager, and written in a simplified form (which is what
GE> one *should* do, no?) I really see little point to make such an
GE> assumption, and I'm sure no one likes being talked down to.

gack, you again? having done a bit of perl, written requirements and
assigned tasks, i would have never said 'must use a subroutine'. that
plus the wording of the other requirements reeks of homework. but you
again seem to take offense at what is patently obvious to all the others
here. why don't you stop doing that and actually either answer his
homework assignment by giving him a fish or stfu. did you even notice
that the assignment is really a simple form of more/less written in
perl? how could that be a real world project assignment? your comment
insults the theoretical project manager by saying he would rewrite
more/less in perl for no reason. how dare you insult him? what gives you
the right to decide he is a poor project manager? maybe he doesn't know
about more/less? maybe he needs a version in perl for some unknown
reason you can't comprehend? i prefer to take the easier assumption
(occam's razor and all) that is is a homework assignment.

now go sit in the corner of the classroom facing the walls!

uri

--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------

Posted by Gordon Etly on May 1, 2008, 11:25 pm
Please log in for more thread options
Uri Guttman wrote:
>
> > > > > > 1. open any text file taken the name from the command line.
> > > > > > 2. read top 20 lines and stops, then
> > > > > > 3. ask to press letter "n or p" (for next/previous) to print
> > > > > > next
> > > > > > or previous 20 lines.
> > > > > > would appreciate any kind of help.
> > > > > > 4. must have subroutine used.
>
> > Why do you all just assume it's a homework assignment? Could it
> > not just as well be a simplified work project? I would not be at
> > all surprised if this was something handed down by one's boss or
> > project manager, and written in a simplified form (which is what
> > one *should* do, no?) I really see little point to make such an
> > assumption, and I'm sure no one likes being talked down to.
>
> gack, you again? having done a bit of perl, written requirements and
> assigned tasks, i would have never said 'must use a subroutine'. that
> plus the wording of the other requirements reeks of homework.

It could be homework, just as it could be any number of things. Could
just be how the OP put together his post, listing what he wanted to do.
The point is _you_ _don't_ _know_.

--
G.Etly



Posted by Uri Guttman on May 2, 2008, 12:11 am
Please log in for more thread options

GE> Uri Guttman wrote:
>>
>> > > > > > 1. open any text file taken the name from the command line.
>> > > > > > 2. read top 20 lines and stops, then
>> > > > > > 3. ask to press letter "n or p" (for next/previous) to print
>> > > > > > next
>> > > > > > or previous 20 lines.
>> > > > > > would appreciate any kind of help.
>> > > > > > 4. must have subroutine used.
>>
>> > Why do you all just assume it's a homework assignment? Could it
>> > not just as well be a simplified work project? I would not be at
>> > all surprised if this was something handed down by one's boss or
>> > project manager, and written in a simplified form (which is what
>> > one *should* do, no?) I really see little point to make such an
>> > assumption, and I'm sure no one likes being talked down to.
>>
>> gack, you again? having done a bit of perl, written requirements and
>> assigned tasks, i would have never said 'must use a subroutine'. that
>> plus the wording of the other requirements reeks of homework.

GE> It could be homework, just as it could be any number of things. Could
GE> just be how the OP put together his post, listing what he wanted to do.
GE> The point is _you_ _don't_ _know_.

and you know it is the opposite? how nice of you to tell us. we will
consult with you before we decide if other posts are homework. will you
be available 24x7 for this job? we all appreciate your doing this
thankless job and for no pay! do you want a long term contract to be the
homework monitor? for no extra pay will you actually answer perl
questions? or will you just make sure we do the right thing and you just
take the glory? please guide us O enlightened one as we need your help!

and there was no sarcasm in that, sincerely!

uri

--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------

Similar ThreadsPosted
filehandle, read lines July 24, 2007, 5:09 am
Read first few lines from command output July 27, 2005, 1:47 pm
Beginner: read in lines array1 and after keyword array2 July 30, 2006, 7:37 am
How to break the lines in printing to html lines? July 5, 2006, 11:21 pm
perl -pe for blocks of lines instead of single lines September 26, 2006, 1:29 pm
How to filter out lines from a variable that has multi-lines? September 28, 2007, 9:09 pm
FAQ 6.3 How can I pull out lines between two patterns that are themselves on different lines? January 27, 2005, 12:03 am
FAQ 6.3 How can I pull out lines between two patterns that are themselves on different lines? May 14, 2005, 5:03 am
FAQ 6.3 How can I pull out lines between two patterns that are themselves on different lines? July 29, 2005, 10:03 pm
FAQ 6.3 How can I pull out lines between two patterns that are themselves on different lines? September 26, 2005, 10:03 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap