Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
go ahead... be a heretic
 
PerlMonks  

Re: New student, can we write this program in perl...

by MidLifeXis (Prior)
on Oct 19, 2012 at 16:49 UTC ( #999981=note: print w/ replies, xml ) Need Help??


in reply to New student, can we write this program in perl...

I would use grep and the % operator. Could also do it with the ternary operator and the % operator (although that is approaching too cute to maintain).

Update: based on other provided information in this thread, you may also want to see print, join, say, and chomp.

--MidLifeXis


Comment on Re: New student, can we write this program in perl...
Re^2: New student, can we write this program in perl...
by rahulraina7 (Initiate) on Oct 19, 2012 at 16:52 UTC
    how do i input array of n numbers in perl sir ..?

      my @data = <> would be one way. Could always read one line at a time with while (<>) {...}. This is stuff that you or your instructor should have already covered in your course, isn't it?

      Update: if not, take a look at perlintro, perlfaq, perlsyn, perldata, and so on.

      --MidLifeXis

        In india we do have to do lots of research work like this, blame it to the poor teaching system.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999981]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-04-21 06:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (492 votes), past polls