RE: Using "do" versus "use" for subroutine

Edward Wijaya wrote:
> Hi,
> I would like to know which of this
> is better and what is the pro and cons:
> 1. A file "" which stored
> a subroutine, and later called by
> main file using:  do ""
> or
> 2. A file "" and called
> in main file using : use ""

The second construct is not valid; the argument to "use" must be a bareword.

It's not really possible to answer your question without knowing more
details. I'm not clear about what's actually in The general answer
is that "use" is the preferred method for bringing in routines, and you
should use proper module construction techniques for writing modules.


   perldoc -q require

for a comparison of the various methods available to you in Perl.
8/6/2004 2:14:58 PM
perl.beginners 29388 articles. 4 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 28
Get it on Google Play
Get it on Apple App Store


Similar Artilces:

"Using" or "With"
Hi all Please can someone enlighten to me as regards the difference with the "Using" and "With" statement when accessing data - which is better, what are the limitations and/or any pointers. Many thanks. Regards DaveDavid WinchesterPlease mark as answer if this is the solution.  using gives you the ability to use the connection and it closes the connection directlly after you finish using it. and there is no need to try- cach - finaly. there is no limitation on using USING keywordMuhanad YOUNISMCSD.NETMy Blog || My Photos || LinkedIn I have a dataobject the re...

Using "+" or "||"
Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in ISQL to indicate a string concatenation. I needed to paste my SQL statement into the PowerBuilder script painter for some embedded SQL, and PB didn't like the "||" very much at all. I changed it to "+" and it seems to be ok. Do these two operators indicate ~exactly~ the same thing? moin, afaik these two's are not the same! if you're using "||" and any term is NULL then in the resultstring the term will be ignored if you use "+" then the resu...

Replacing "use base" with "use parent"
--bcaec554da9c7514d304ca32ffa3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, From the documentation< N>: Unless you are using the fields pragma, consider this module discouraged in favor of the lighter-weight parent . From the documentation< Y> : This module was forked from base to remove the cruft that had accumulated in it. is a 30 lines pure Perl dual module available also in core since 5.10...

.ALLCOL("%COLUMN%", " ", ", ", ", ")
Do you know anyway for me to exclude a subset of columns returned by this function. We have two columns (rec_user and rec_datetime) which are in all of our tables, but when generating triggers I want automatically generate a script which does not include those two columns but does include all other columns in that table. Bruce I should add that I am using PD Bruce "Bruce Lamb" <> wrote in message > Do you know anyway for me to exclude a subset of columns returned by this > function. ...

Precedence of "where" ("of", "is", "will")?
Nobody on #perl6 today could answer this one. Is: Str | Int where { $_ } the same as: (Str | Int) where { $_ } or: Str | (Int where { $_ }) ? Followup questions, Mr. President: What kind of operators are "where", "of", "is", and "will"? Is there a reason that S03 doesn't list them? What are their precedence(s)? -- Chip Salzenberg - a.k.a. - <> Open Source is not an excuse to write fun code then leave the actual work to others. Chip Salzenberg writes: &...

RFC: interactions between "use bytes", "use locale", and "use feature 'unicode_strings'
I am waiting for blead to reopen before I submit a patch for extending feature unicode_strings to matching \s, and \w. In documenting it, it occurred to me that the existing implementation is wrong, along with the existing interaction between use bytes and use locale. To refresh your memory, "use feature 'unicode_strings'" is supposed to mean that even non-utf8 data is to be considered to have Unicode semantics. In practice, this only affects the characters from 128-255. It is new in 5.12, and is implemented there only on functions that change case, such a...

RFC: Make "use 5.14" select "use re '/a' " ?
I have pushed to blead (with Jesse's permission) the last commits (besides doc and any bug fixes) that enable the /a regular expression modifier. Presuming it works ok, should this become the default method of operation, signified by a "use 5.014" ? On 1/17/11 11:02 AM, Karl Williamson wrote: > Presuming it works ok, should this become the default method of > operation, signified by a "use 5.014" ? So when I upgrade my code, I have to put "no re '/a'" in every file? Why, oh why? On Mon, 17 Jan 2011, Elliot Shank wrote: > ...

how to use "Match" the special char "\" as using filter
Thx JJ \\ "JJ" <> wrote in message news:404bd593$1@forums-2-dub... > Thx > JJ > > ...

use of "?" operator instead of "if"
Hi: I have this statement which checks for existence of the $VAL variable and performs certain actions if($VAL){ $VAL = "$VAL:$expr"; } else { $VAL = "$expr"; } Can this 4 line statement be reduced to a single line using "?" operator? Thanks Ravi __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more It's called the ternary operator, and works like this: $VAL ? $VAL = "$VAL:$expr" : $VAL = "$expr"; IF_EXPR ? T...

What are "ClassifiedsView_Ads" and "PhotosView" used for ??
This two items are stored in the DB "Views" folder,  i have a bit of knowledge about relational database, tables, keys/foreignKeys, etc. But i don't understand for what this two views are used for.  Thanks in advance for any help you might give me.There are 10 types of people in this world:Those who understand binary and those who don't. I think i solved my own problem,  The  "ClassifiedsView_Ads" view seems to be used on the stored procedures:(ClassifiedsView_Ads ; GetAllAdsByQuery; GetAdsByStatus , GetAdsByRandomOrder)  ...

Syntax of "use"/"require"
(This thread is referencing I'd like to start writing the Module::Build/ExtUtils::MakeMaker for Pugs. One of the first things that was mentioned was that the syntax for use needs to support specifying the exact version or range of versions you want to have. There has also been mention of the fact that module installation needs to tag the author, as well as other features. Would someone please mind listing all the functionality desired for module installation as seen from "use"? Thanks, Rob On 5/28/05, Rob Kinyon <ro...

quotes, quotes, quotes...
I am getting this error and I know what is causing it, but I have no idea how to fix it, any help would be great. The script steps through the /var/log/messages file on a linux server and puts The entries into a mysql database. However when it gets to the 'hlt' line in the messages file it just barfs. The single quotes are freaking it out. I know about quotes but not how to use in this situation. Thanks, Paul Error: May 27 17:53:00 localhost kernel: Checking 'hlt' instruction... OK. <----- doesn't like this in the messages file DBD::mysql::st exec...

All the possible "environment" or "IDE" variables "$(....)" one can use
Good day Is there a list of all the possbile environment or IDE variable names that one can use in Delphi? I am talking about all the identifiers which are put inside $(...) to point to some value. Anything from $(Platform) to $(BDSCOMMONDIR) and in between. I have been searching in help and on the web and have not found any list. I suspect I might be searching for the wrong name. I reckon "Environment Variables" only cover those provided by the OS and also paths that Delphi uses but then there are ones provided by Delphi based on other criteria like "Platform" and &...

Packages to install to use "mkuser" and "passwd" or "pwdadm" commands
Hello everybody, can anyone suggest me what packages do I have to install to use user admin commands stated in Subject? Hope to hear from you soon, Paolo De Nictolis Paolo, It appears that in the past few days you have not received a response to your posting. That concerns us, and has triggered this automated reply. Has your problem been resolved? If not, you might try one of the following options: - Do a search of our knowledgebase at - Check all of the other support tools and options available at

Web resources about - RE: Using "do" versus "use" for subroutine - perl.beginners

Resources last updated: 12/25/2015 8:04:30 PM