|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Code:
#!/usr/bin/perl
$f = "code.txt";
$n = "0";
open (TXT,"$f");
print "Content-type: text/html\n\n";
seek (TXT,0,0);
while ($line = <TXT>) {
$n++;
print "$n $line<br>\n";
}
close (TXT);
This codes works when it comes from a file. What would you change it to to get the info from a form? <TEXTAREA NAME="code" rows=15 cols=60> |
|
#2
|
||||
|
||||
|
The input from a textarea all comes in a single scalar variable. Use the 'split' function to divide that data up into lines.
__________________
~ishnid; Have you tried: [ search.cpan.org | perldoc | Java API | mysql.com | google ] Apostrophes are NOT used for possessive pronouns or for noun plurals, including acronyms. |
|
#3
|
||||
|
||||
|
__________________
--Ax without exception, there is no rule ... The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones ![]() 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. -- Jamie Zawinski |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Getting Line numbers in perl. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|