in reply to text files are printed after the end of second module

Hi greetings to everyone.I am here to seek the wisdom of monks,here is my issue.

This seems familiar, maybe you missed my reply from yesterday Re: loop exits after printing the file

do is not how perl programmers make modules, or use modules; modules should only define/create subroutines, they shouldn't do anything on their own ... there should be no code outside of subroutines, subroutines should be self contained

Making a real module is easy if you follow these examples: Re: loop exits after printing the file, zentara package/module tutorial

If you write code this way and create real modules, with subroutines that take arguments and return values, it will be easy to figure out why you need to call your program twice for the files to be created in time to do the comparison

MakeFilesOrDie( $these, $files ); CompareFilesOrDie( $these, $files );

What you have posted is like a magic act

$url=$_; &domain_check(); $x="$competitor.html";

What does domain_check do? Where does $competitor come from?

Why doesn't domain_check take arguments?

Why doesn't domain_check return values?

Maybe it should be  my $competitor = domain_check( $url ); but its impossible to know, your posted program has many missing pieces...

Its like a buying stuff at a store, the buyer doesn't reach into the cash register to pay for items and get change, the buyer gives money to cashier, the cashier gives change back or ask for more money

my $change = gimmeChange( '20USD', 'milk','cookies' ); sub gimmeChange { my( $payment , @items ) = @_; my $price = gimmePrice( @items ); my $diff = $payment - $price; if( $payment < $price ){ warn "You don't have enough money, you need $diff"; } return $diff; }

Replies are listed 'Best First'.
Re^2: text files are printed after the end of second module
by myfrndjk (Sexton) on Jul 07, 2014 at 12:28 UTC

    Hi all thanks for your reply and suggestions I started to learn perl before 1 week only and really I don't know how to write a code clearly .I will take all your suggestions and try to improve myself.Thanks for you time and suggestions.