Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: How do i take the first 4 characters of any file name in a specified directory?

by jonadab (Parson)
on Sep 17, 2008 at 12:09 UTC ( #711972=note: print w/ replies, xml ) Need Help??


in reply to How do i take the first 4 characters of any file name in a specified directory?

@name1 = $nameline;

I am almost certain this line doesn't do what you think it does. There are other ways to solve the problem, but if what you want is to assign all the characters in a string to an array, you can use the split function with an empty regex.

Also, the print on the next line only prints out one of the array elements (specifically, the number 3 element, i.e., the fourth). If you want several elements at once, use slice syntax.

HTH.HAND.
-- 
We're working on a six-year set of freely redistributable Vacation Bible School materials.


Comment on Re: How do i take the first 4 characters of any file name in a specified directory?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2014-10-21 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (111 votes), past polls