Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Appending to a file.

by AnomalousMonk (Archbishop)
on May 07, 2012 at 19:34 UTC ( [id://969319]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Appending to a file.
in thread Appending to a file.

xavierarmadillo: I see that in your latest posting the substitution
    s/nodata/$secondary/gi
has become
    s/0;nodata/1;$secondary/gi
adding '0;' and '1;' to the mix. Maybe this is intentional, but I just thought I'd mention it.

Another point is that you are now defining the  addSecondary function with an empty prototype, meaning that the function takes no arguments — and then you pass it two arguments! This suggests to me that you are calling the function in a way that causes Perl (not PERL) to ignore prototypes. If prototypes do nothing in your program, or you don't fully understand them, or both, why bother to use them?

The final and perhaps most important point is that it is wise always to enable warnings and strictures at the beginning of a program, and as you are a newcomer to Perl, to enable diagnostics. So your program would begin with the following lines:
    use warnings;
    use strict;
    use diagnostics;  # for good measure
See warnings, strict and diagnostics.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-03-19 04:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found