Hi Rakesh, On Wed, 10 Jun 2015 18:10:12 +0530 rakesh sharma <rakeshsharm...@hotmail.com> wrote:
> Hi Krzysztof > If that was the case , using the subs inside Carp should not show any > error.Bu I was not able to use cluck without using qw and was able to use > croak and confess without the qw.Don't get it thanksrakesh > First of all, qw(...) is a notation for writing a list of uninterpolated strings: #!/usr/bin/perl use strict; use warnings; use Data::Dumper ("Dumper"); my @x = qw(Foo bar baz cloox matista englame09555 343); print Dumper(\@x); shlomif@telaviv1:~$ perl Test.pl $VAR1 = [ 'Foo', 'bar', 'baz', 'cloox', 'matista', 'englame09555', '343' ]; shlomif@telaviv1:~$ Secondly: use Carp qw(cluck); is equivalent to: use Carp ("cluck"); Finally, if you do «use Carp;» it will try calling Carp->import() with no arguments which will import the default symbols. To not import anything , one should write «use Carp ();». For more info see: http://perldoc.perl.org/functions/use.html For good measure and maintenance sanity, one should explicitly import all the needed symbols and not rely on the default «use Carp;» imports. See: http://perl-begin.org/tutorials/bad-elements/#non_explicitly_imported_symbols (*NOTE*: I have created that page and still maintain it.) Regards, Shlomi Fish > > Date: Wed, 10 Jun 2015 14:30:28 +0200 > > From: bars0.bars0.ba...@gmail.com > > To: rakeshsharm...@hotmail.com; beginners@perl.org > > Subject: Re: When is qw used > > > > Hi, > > > > As far as I know qw(some list item) will import from Carp module only > > subs that you've explicitly requested. In this example `some, list, > > item` will be available in your namespace but not other from Carp module. > > > > `use Carp;` will import all of them. > > > > Krzysztof > > > > > > On 2015-06-10 14:19, rakesh sharma wrote: > > > I have seen perl syntax like use Carp qw(some list items) > > > so when do we need to write like this and why is not the items of the > > > module getting imported > > > > > > > > > thanks > > > rakesh > > > > -- > > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > > For additional commands, e-mail: beginners-h...@perl.org > > http://learn.perl.org/ > > > > > -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ My Photos - http://www.flickr.com/photos/shlomif/ How can you make a programming language that will be good for everything if you cannot even make such a screwdriver? — An Israeli Open Source Software Enthusiast. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/