Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://711972]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found