Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Creating folders using strings

by 2teez (Vicar)
on Nov 22, 2012 at 15:39 UTC ( #1005150=note: print w/replies, xml ) Need Help??

in reply to Creating folders using strings

Hi learninPerl,
choroba has given you in my considered opinion, the best answer. However, if you don't mind, there are some good practice you may develop as you program in Perl.

  1. use warnings and strict in your script
  2. Avoid bareword as filehanles, use lexical variable in your open function.
    use 3 argument open function and always check, if that fails. The same goes for close function.
    like so:
    open my $fh,'<', $filename or die "can't open file: $!"; ... close $fh or die "can't close file: $!";
    or use autodie qw(open close); Then, is no need to check.

In addition, you can actually run your script from the location, where you wanted the folders to be created ( but that will be 'restricting' yourself script ) :).

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005150]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2018-02-21 20:11 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (287 votes). Check out past polls.