|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
I know it's a newbie question, but does anybody know why
the line "print OUT $aaa;" does not write onto the file OUT and "print OUT "/***\n";" does??? I'm sure it goes into the if statement 'cause i can see the line "found the function: ..." on the STDOUT. (I also tried using $_ instead of $aaa) I just want to put a line read from the file IN and write it onto OUT if the regexp is matched. ################# CODE ############# open (IN, "< $ARGV[$i]"); open (OUT, "> $ARGV[$i].pod"); print OUT "/***\n"; ### WORKS ### while ($aaa=<IN>) { print OUT "=head1 NAME\n\n"; if ($aaa =~ /^\s*function\s*\S+/) { $aaa =~ s/^[\s]*//; print "found the function: $aaa\n"; print OUT $aaa; ### DOES NOT WORK ### } close (OUT); } close (IN); } ########### END OF CODE ############# Any help will be really really really appreciated. thx in advance... --------- eepyoga. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > writing to file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|