Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Directory Structure.

by hippo (Bishop)
on Mar 31, 2017 at 12:59 UTC ( #1186617=note: print w/replies, xml ) Need Help??


in reply to Directory Structure.

chdir $file; chdir $dir;

Can you explain the purpose of that?

ISTM that your code has too many statments. Here's an SSCCE

#!/usr/bin/env perl use strict; use warnings; use Test::More tests => 3; # Do all this in /tmp because we don't want permission trouble or to # pollute real dirs while testing chdir '/tmp'; my $dir = 'VEHICLES'; my @files = qw/CARS BIKES/; mkdir $dir; ok (-d $dir); chdir $dir; foreach my $subdir (@files) { mkdir $subdir; ok (-d $subdir); }

Running gives:

$ ./ex.pl
1..3
ok 1
ok 2
ok 3
$ tree VEHICLES/
VEHICLES/
├── BIKES
└── CARS

2 directories, 0 files
$ 

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2023-09-21 23:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?