Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/bin/perl -w use strict; use warnings; use File::Copy; use Cwd; my $dir = cwd; main(); sub main { # ... }

Aside from the first 3 lines here, I am intrigued by how you have structured this code. Did you learn this from a course or a book or are you translating from some other language?

Can you explain why you have used File::Copy? Or Cwd? Why do you set $dir and then never subsequently refer to it (and BTW the same for $name, $variable1, $variable2)? What is the purpose of encapsulating code in sub main() when there's nothing relevant outside that scope?

As you say you are new to Perl it would probably be beneficial for you to understand what the code you have already written is actually doing. If you cannot explain what you have written, start from code you do understand instead.

Good luck.


In reply to Re: Merge the difference between two files by hippo
in thread Merge the difference between two files by hopper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-25 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found