How to make a long print string to shotcut form in perl?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to make a long print string to shotcut form in perl?
# 1  
Old 06-29-2010
Question How to make a long print string to shotcut form in perl?

Code:
  print "1.readfromfile\n2.add_ex1(4,5)\n3.add_ex2(11,5)\n4.add_ex3(9,3)\n5.add_ex4(91,4)\n";

How to do it in this form:
Code:
  print "1.readfromfile\n
           2.add_ex1(4,5)\n
           3.add_ex2(11,5)\n
           4.add_ex3(9,3)\n
           5.add_ex4(91,4)\n";

# 2  
Old 06-29-2010
Code:
print "1.readfromfile\
           2.add_ex1(4,5)\
           3.add_ex2(11,5)\
           4.add_ex3(9,3)\
           5.add_ex4(91,4)\n";

This works too:
Code:
print "1.readfromfile
           2.add_ex1(4,5)
           3.add_ex2(11,5)
           4.add_ex3(9,3)
           5.add_ex4(91,4)\n";

# 3  
Old 06-29-2010
Code:
print     "1.readfromfile\n",
           "2.add_ex1(4,5)\n",
           "3.add_ex2(11,5)\n",
           "4.add_ex3(9,3)\n",
           "5.add_ex4(91,4)\n";

# 4  
Old 06-29-2010
Done.
Thanks jim mcnamara.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert FF (feed form) in text file so that when printing the printer print on a new page accordingly

Hello. First happy new year to everybody. I have a script that generate a text file ( /tmp/part_list.txt for example ). This file can be edited using a kde graphical text editor like kate or kwrite The file can be printed out from command line or within the text editor using the print... (5 Replies)
Discussion started by: jcdole
5 Replies

2. Shell Programming and Scripting

Need to search a particular String form a file a write to another file using perl script

I have file which contains a huge amount of data. I need to search the pattern Message id. When that pattern is matched I need to get abcdeff0-1g6g-91g3-1z2z-2mm605m90000 to another file. Kindly provide your input. File is like below Jan 11 04:05:10 linux100 |NOTICE... (2 Replies)
Discussion started by: Raysf
2 Replies

3. Shell Programming and Scripting

Copy last third char form string

HI Input A.txt ABC907 ABC907_1B_9 ABC985 ABC985_1A_9 ABC985 ABC985_1B_9 ABC985 ABC985_1C_9 ABC05037 ABC05037_1A_9 ABC05037 ABC05037_1B_9 Base of column 2 last third char. If It is A the 1,if B then 2 If C then 3 File B.txt ABC907 ABC907_1B_9 2 ABC985 ABC985_1A_9 1 ABC985... (8 Replies)
Discussion started by: asavaliya
8 Replies

4. Shell Programming and Scripting

Inserting into long delimited string using perl.

Hi, I have a very long pipe delimited string. The length of the string could vary. For example: START|one|two|three|four|five|six|seven START|one|two|three|four|five|six|seven|eight|nine START|one|two|three|four I want to replace in the third occurence of string with another... (9 Replies)
Discussion started by: som.nitk
9 Replies

5. Shell Programming and Scripting

Parsing a long string string problem for procmail

Hi everyone, I am working on fetchmail + procmail to filter mails and I am having problem with parsing a long line in the body of the email. Could anyone help me construct a reg exp for this string below. It needs to match exactly as this string. GetRyt... (4 Replies)
Discussion started by: cwiggler
4 Replies

6. Shell Programming and Scripting

Perl : Find a string and Print full line

Hi Need a perl script to read lines in a file, scan for a string named "APPLE" and write to different file the only lines containing the matched string. (5 Replies)
Discussion started by: PrasannaKS
5 Replies

7. Shell Programming and Scripting

Trim leading zeros to make field 6 characters long

Hi all- I've got a file that will have multiple columns. In one column there will be a string that is 10 digits in length, but I need to trim the first four zeros to make it 6 characters? example: 0000001234 0000123456 0000234566 0000000321 output: 001234 123456 234566 000321 (5 Replies)
Discussion started by: Cailet
5 Replies

8. Web Development

in cgi perl script a form

hi,i hav a form in cgi perl script.this script accepts a value from user from another html form, and depending upon this value,i need to disable /enable radio buttons in cgi-perl script wen second page is displayed on executing cgi perl script.how do i do it using javascript? (0 Replies)
Discussion started by: raksha.s
0 Replies

9. Shell Programming and Scripting

form validation with perl

Hey guys, I'm just messing around with a perl webpage. The idea is to make a simple validation form that will later insert a record into my DVD database. it's all very basic at the moment, and I worked up my script from the form validation example I found on this website:... (5 Replies)
Discussion started by: LNC
5 Replies
Login or Register to Ask a Question