Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Merge the difference between two files

by hopper (Novice)
on Jun 16, 2017 at 16:35 UTC ( #1192967=note: print w/replies, xml ) Need Help??


in reply to Re: Merge the difference between two files
in thread Merge the difference between two files

Thanks for taking your time to look over my code. Like I said, I am new to Perl and would like to learn how to do multiple tasks using Perl so I self taught myself and didn't learn this language from school or book. You are correct, I should remove the lines "used File::Copy? Or Cwd:" since I don't know what they mean. I was copy the template from other blogs and forgot to remove them. I want to use the "my $dir.." because I want to verify and make the files that I am working on are in the same directory as the Perl scrip. I used sub main because I need to the script to do multiple tasks after it is merging. Thanks gain.
  • Comment on Re^2: Merge the difference between two files

Replies are listed 'Best First'.
Re^3: Merge the difference between two files
by hippo (Bishop) on Jun 17, 2017 at 09:02 UTC
    You are correct, I should remove the lines "used File::Copy? Or Cwd:" since I don't know what they mean.

    Perl is one of those long-established languages which has very extensive documentation. Your installation should have the perldoc command which will help but if it is not there you can use the online version instead (see how the word perldoc looks like a link? It is one!). The customary place to start is with perlintro but you can follow the "use" link in my previous post which explains in a rather dry way what that command does. You have lots of reading ahead of you!

    I was copy the template from other blogs and forgot to remove them.

    It's tempting when learning a new language to just copy code from somewhere else and hack it about to make it do something slightly different. However, it does pay to understand the code you are copying before you start to hack it about.

    I want to use the "my $dir.." because I want to verify and make the files that I am working on are in the same directory as the Perl scrip.

    Fine, but you are not using it in this example. The principle of an SSCCE is to reduce the example code to the minimum required (the first S stands for "Short"). It's a distraction to you and us so you may as well remove it for now. $dir isn't doing what you think anyway.

    I used sub main because I need to the script to do multiple tasks after it is merging.

    OK, but be careful about scoping. And try to avoid the particular word "main" since that's also a built-in package name in Perl and as a beginner you may get confused between warnings/errors which relate to either your "main" sub or the main package.

    Keep at it - you are at the beginning of a long, winding, fascinating and ultimately fulfilling path. We all started where you are now.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2023-03-27 22:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (66 votes). Check out past polls.

    Notices?