Searching text with perl

  • dreamer7
  • Student
  • Student
  • dreamer7
  • Posts: 95
  • Loc: UK

Post 3+ Months Ago

Ok well its been ages since i've posted here so i thought i'd give you a treat lol :lol: ok my problem is i am making a rate my picture thing and so far i have made a javascript script which produces a random picture from an array of pictures on a web page plus an perl upload script i made to upload peoples pictures and makes it into a random number and saves it. The thing is every time someone uploads a picture i need the javascript script to be edited so that there is that picture in the array. So... i need to know how you find a specific place in a text file add a new line and then add text. If you understood that and can help it would be much so appreciated.
d7
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

I don't know if you could do this, but it makes more sense:
Why not put all the files in a directory, then use perl to get all the files from a certain director ending in .jpg (i know PHP has this function), hopefully it puts the files in an array, then just use a random variable and pick out one of the pictures.

Or is that not going to work? Having a long array just seems excessive...
  • dreamer7
  • Student
  • Student
  • dreamer7
  • Posts: 95
  • Loc: UK

Post 3+ Months Ago

Yea that sounds a lot easier lol i might just do that. Thanx.
d7
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

:-P thats how I did my signature changer! you just have to upload files, and when the script is run, it automatically enters the new files into a database, you just have to make sure you keep the file names persistant, even just appending them with their id and a '.' then striping everything after the . works too :-P

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 67 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.