From: Robert Klemme Date: 2009-03-26T20:54:54+09:00 Subject: Re: passing parameter 2009/3/26 Arun Kumar : > Hi, > This is my code strip > >  contents.each do |content| >                    #scanning the content using regexp to fetch the url >                    url = content.scan(/(http:\/\/.*|https:\/\/.*)/i) Two notes: #scan returns a potentially empty Array and not a single object. And you can make the regexp simpler and more efficient at the same time /https?:\/\/.*)/i Note also that using ".*" is dangerous because depending on your input this may match too much. >                    data = Net::HTTP.get(URI.parse("#{url}")) The construct "#{expr}" is better replaced by expr.to_s and in this case, since url should be String you do not even need that. >                    #extracting the feeds url from 'data' using 'regexp' >                    xml = data.scan(/ rel="alternate".*?href="(.*?xml|.*?rdf)"/i) >                end > > Now what i want is to pass the 'xml' variable as a parameter to the next > class but i'm not able to do that because the 'xml' variable is inside > an array. Can anybody please tell me about how to do it. Where is "xml in an array"? The variable "xml" references an Array because you use String#scan (see above). You can simply iterate that Array as any other Array, too. Where is the problem? Cheers robert -- remember.guy do |as, often| as.you_can - without end